Reputation: 958
I have an app in plain html file (no server). How do I do cross domain requests (from javascript)?
Browser reports error: XMLHttpRequest cannot load '*'. No 'Access-Control-Allow-Origin' header is present on the requested resource.
I tried the following, but no dice.
<meta http-equiv="Access-Control-Allow-Origin" content="*"/>
Upvotes: 0
Views: 2126
Reputation:
You need to set an Access-Control-Allow-Origin
HTTP header (not an HTML <meta>
tag) on the target resource. Set it to either Access-Control-Allow-Origin: source-domain.example.com
to allow only your source domain access to it or Access-Control-Allow-Origin: *
to allow any domain access. The first is preferred.
Upvotes: 1
Reputation: 944442
meta http-equiv
is not equivalent to an HTTP header. You must make a request to an HTTP server, and it must respond with real HTTP headers.
Upvotes: 0