I'm an entrepreneur from Madrid working on a social startup.
I'm using jqueryMobile framework + phonegap to develop an app.
I'm dynamically injecting pages using href="" into the DOM but it seems that Chrome do not handle $ajax based JM single page navigation model. I get an error loading page message and this error from the tool developer console while clicking on the navMenu: XMLHttpRequest cannot load file:///C:/git/app/myapp/assets/www/html/page2.html. Origin null is not allowed by Access-Control-Allow-Origin.
Probably it has to do with cross-border petitions, but I can't find how to solve it.
I don't want to disable $ajax petitions because then it won't auto generate some useful functionality like DOM size management (avoid device slowdown that causes crash), <back> button and transitions.
A simple google of this would give you an idea of what is going on. Google chrome doesn't allow this to work when running locally. Notice it thinks the origin is null - you are running this locally. Firefox will allow this, try running this with Firefox. Otherwise you will have to host and test instead of testing locally.
Google this for more info: Chrome + Origin null is not allowed by Access-Control-Allow-Origin.
Firebug plugin from Firefox don't have so many features...
Easiest/best thing is to build the PhoneGap app and install on iPhone Simulator, iPhone device, Android simulator (horribly slow, though) or Android device.
For iPhone, if you install on iOS 6.0 or later, you can use Safari remote web inspector (even on real device!). You can examine the DOM, set breakpoints, trace, etc. etc. etc. Run the simulator or connect your device by USB, open the "develop" menu in Safari, and you should see your device or simulator in the menu.
For Android, you can use Weinre to do similar things.
If you insist, you can coerce Chrome to allow cross-origin access:
The first thing I did before submiting a new post on this forum was asking google about this issue.
I tried many things from stackoverflow including --allow-file-access-from-files option but didn't work at all...
After working on it for two days I decided rely on this jquery community.
@watusiware thank you for your reply too.
EDIT: I've found a way to disable Chrome security and same origin rule so it seems that now it has access to local files.
After all this, the new point is:
As Android and Chromedevelopers share same CVS Google server, seems logical that some Android devices may now or in the near future use Chrome technology for AndroidWebView component. So, does jquery mobile single page navigation model guarantee its complete functionality on all Android devices if persist on dinamically injecting pages into the DOM?
Leave a comment on watusiware's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic