I use ajax request in order to check response of websites as follow,
$.ajax ({
url: 'https://www.example.com',
cache: false,
success : function() {
alert(new Date() - start)
},
})
It works on my local pc in all browsers. When I put it on the server, it works in Chrome and Firefox but not in IE8.
I get the error: "Access is denied" jquery.min.js
Why am I getting this error?
Note -- Note do not use "http://www.domain.xxx" for URL in ajax. only use path(directory) and page name without address.
false state:
true state:
I had this problem in IE8. What solved it for me was changing my ajax request to use the same protocol as the original page request. In my case the original page was requested over https and the ajax request was using http. Switching them both to use https fixed the problem.
--- JAN 2014 ---
IE8 and IE9 use a different method (XDomainRequest) to communicate with cross domains. You should consider using this if they are using jQuery:
https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
Make sure to use the same protocol as the originating call, i.e. HTTP or HTTPS.
For my case the problem is resulted because of compatibility mode. I am in intranet and internet explorer is running with compatibility mode. I added following tag and this solved all my problems. It forces IE to not use compatibility mode.
Quoting "epascarello" from an other very similar question :
Making a call to a sub domain is seen as a different domain because of the Same Origin policy. Make sure that you are setting document.domain to avoid access denied with the Same Origin policy.
To get the document.domain in sync you need to set it in two places. Add a script tag that set the domain, and you need to have an iframe on the page that sets the same thing on the other domain.
The page that the Ajax call is made from "www.example.com" and is calling "ajax.example.com":
The "domainCode.html" would just contain the script tag
With that in place you should be able to talk between your sub domains.
Hope that helps !