Design Blog

JQuery .load() Doesn’t Work in Chrome

March 25, 2011 | Filed Under Code Snippets, JavaScript by

If you do any front-end development locally (and test in Google Chrome) you may have run into a problem using the .load() function or other AJAX requests. The functions are just unable to return any data, It boils down to a permissions issue with Chrome pointing to local files.

You can resolve this by uploading your files to a live production server, but that is a pain, especially if you’re still in development.

There’s a very simple solution:

1. Close Chrome completely
2. Launch Chrome from Terminal with the “–allow-file-access-from-files” argument

open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

This will allow that session of Chrome to access local files. Note: Once you close and reopen the application you’ll no longer have access to local files again.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>