We use Phonegap / Cordova 2.3.0 to deploy the application on Windows Phone 7. The application uses Require.js to dynamically load all modules. One module is called a “router” and is responsible for collecting static html from local files and loading their contents into a <div> . It works on iPhone, iPad and Windows Phone 8. But there is something strange happening in WP7.
Sample code from router.js :
//path that works with WP8 var path = "www/views/"; $.ajax({ url: path + "test3.html" }) .done(function(html) { alert(html); //result from Windows Phone 8 }).fail(function(error) { alert(error); //result from Windows Phone 7 });
The error that occurs when testing on WP7 is not 404 Not Found.
I say “something strange” because I can copy the exact code above into main.js (the require.js entry point) or index.html and it will work without errors. But when I put this code in my router.js , it returns an error.
Some observations:
router.js is located in the same folder ( /www/js ) as main.jsindex.html is located in the /www folder.- I tried every combination of paths, I could think of stumbling onto the one that worked.
/app/www/views , app/www/views , /www/views , www/views , /views , views and even x-wmapp0:/app/www/views and x-wmapp1:/app/www/views . - Obviously, I presented a simplified example. If you need more, just tell me.
source share