Chrome SecurityError loading jQuery Mobile page from local file system Chrome SecurityError loading jQuery Mobile page from local file system google-chrome google-chrome

Chrome SecurityError loading jQuery Mobile page from local file system


This error is same as the origin is null error. This error occurs because of the security feature of Chrome.A simple solution to test the application is to bypass this security on chrome.

Steps:

  1. create a chrome browser shortcut on desktop.
  2. Close all the instances of chrome on your machine.
  3. Right click on the desktop shortcut of chrome and click on Properties.
  4. in Target field, append " -allow-file-access-from-files" at the end.
  5. Save and close properties.
  6. Open chrome via this shortcut only.

Hurry, the error has gone. App works perfectly.

NOTE: This is just a work-around I use to test my cordova apps on desktop browser for UI testing.


Temporary solution: I've commented out all history.replaceState calls in jquery mobile, didn't need to manipulate browser history in my app anyways.

I wonder if it's chrome security bug or model and future behavior.


On a Mac I was able to fix this by running a webserver instead of loading it from a "file://" url:

http://lifehacker.com/start-a-simple-web-server-from-any-directory-on-your-ma-496425450?utm_expid=66866090-49.VYy4WCNHSyuP6EmjnM93MQ.0&utm_referrer=https%3A%2F%2Fwww.google.com%2F

python -m SimpleHTTPServer 8000

In the directory should make it available from Chrome via 0.0.0.0