Array
University of Oregon

How to Disable Browser Security Restrictions

Ordinarily, we send AJAX http Get requests to the same server that delivered the .html, .css and .js files. The requested resources are hosted on that server.

The examples in Ch. 5, as written, run AJAX requests locally, to request resources hosted on your computer. To do this, you must turn off browser security restrictions that prohibit JavaScript from accessing the local file system. This is generally not a good idea– if you forget to turn them back on and start surfing the web, you are in trouble.

See p. 156:
1. Exit Chrome.
2. Execute one of these commands:

OS X. Execute this command in the Terminal:

open -a Google\ Chrome --args --allow-file-access-from-files

Alternately, this command should work, too:

open -a Google\ Chrome --args --disable-web-security

Windows.

Method 1: Click the Start button. In the Search box, type Command Prompt.
Then, in the list of results, double-click Command Prompt. 
Move to the folder containing Chrome.exe, and run this command: 
chrome.exe --disable-web-security.
Method 2: Open the Start menu.
Enter run in the search bar.
Execute this command:
%userprofile%AppDataLocalGoogleChromeApplicationchrome.exe
–allow-file-access-from-files

3. The above commands should start Chrome and permit JavaScript to access local files.

Important! Restart Chrome normally after working on these examples.

Skip to toolbar