Monday, January 18, 2016

Disable same origin and local url loading in browser for testing

Change local files security policy

Safari

Enable the develop menu using the preferences panel, under Advanced -> "Show develop menu in menu bar"
Then from the safari "Develop" menu, select "Disable local file restrictions", "Disable Cross-Origin Restrication", it is also worth noting safari has some odd behavior with caches, so it is advisable to use the "Disable caches" option in the same menu; if you are editing & debugging using safari.

Chrome

Close all running Chrome instances first. The important word here is 'all'.
On Windows, you may check for Chrome instances using the Windows Task Manager. Alternatively, if you see a Chrome icon in the system tray, then you may open its context menu and click 'Exit'. This should close all Chrome instances.
Then start the Chrome executable with a command line flag:
chrome --allow-file-access-from-files --disable-web-security
On Windows, probably the easiest is probably to create a special shortcut icon which has added the flag given above (right-click on shortcut -> properties -> target).

Firefox

  1. Go to about:config
  2. Find security.fileuri.strict_origin_policy parameter
  3. Set it to false