I\'m putting together some demo pages, and one of the things I want to demonstrate involves fetching HTML fragments dynamically with subsequent processing. Thus I\'ve got si
Had the same issue in Safari+Firefox:
The alert in code below does not run:
$.getScript('script.js', function () { alert("Script loaded and executed."); })
Loading an external file instead of script.js will run.
You can add --allow-file-access-from-files
to the command line when launching chrome to disable this security feature :)
Is it a bug? Maybe, maybe not, what's happening is it's not treating file://
as a single domain, requests to a different file are treated as a different domain and therefore blocked by the SOP rules. It's a choice by the Chrome/Chromium developers, whether it's the correct one depends on your point of view I suppose.
There's a lot of dicusssion on this in the Chrome issues section on Google code, you may find the discussion of interest, here and here.