Export to GitHub

google-ajax-apis - issue #427

Allow cross domain origin access to using http header


Posted on Apr 13, 2010 by Quick Camel

I am trying to use the hosted version of jQuery in a user-script, but since Google Chrome runs user-scripts in a sandbox the only way I am able to include jQuery is by copying/pasting the minified version or loading and evaling it using an xmlhttpRequest. Using xmlhttpRequest seems like a better way to go since it will make the scripts smaller and often already be in the user's cache, but Google Chrome also restricts xmlhttpRequests using the same-origin policy, so I would need to either host it on the same domain as the website (not feasible for user-scripts) or use a CDN that includes the 'Access-Control-Allow-Origin: *' header defined by the W3C Cross-Origin Resource Sharing (http://www.w3.org/TR/access-control/). Is there any way to change the http://ajax.googleapis.com CDN so that it will set this header and allow cross-origin access to jQuery and other ajax libraries?

Comment #1

Posted on Apr 14, 2010 by Quick Camel

More details here:

http://stackoverflow.com/questions/2626367/any-hosted-versions-of-jquery-that-have-the- access-control-allow-origin-head

Comment #2

Posted on Jan 4, 2013 by Happy Cat

Not sending CORS headers also now means any script error details sent to window.onerror will be scrubbed and contain no useful information.

See http://stackoverflow.com/a/14165776/201952

Status: New

Labels:
Type-Suggestion