[ACCEPTED]-Access-Control-Allow-Origin issue with and without www in url-cross-domain
You shouldn't use absolute URLs in your 9 app unless absolutely necessary.
I.e. you 8 should have "http://example.com" in 7 your code if the app can be loaded from 6 http://www.example.com.
For instance, if you want to load some 5 data from, e.g. http://example.com/abc/def, then put
"/abc/def" in your code, not
"http://example.com/abc/def". That 4 way, the browser will resolve the URL to 3 either http://www.example.com/abc/def if the app has been loaded from 2 http://www.example.com, or to http://example.com/abc/def if it's been loaded from http://example.com. And 1 you never risk to hit the Same-Origin Policy.
You should only host a website under a single 2 sub/domain. All traffic to
http://www.example.com should be redirected 1 to
http://example.com or vice versa.
More Related questions