Jump to content

Looking for Xdomainrequest solution for local pages


wapper
 Share

Recommended Posts

Hello,I am a web developer and I just added XDomainRequest function in my script.By loading the page from the server, everything is fine(in IE, Firefox & Chrome), idem for local pages but not in IE & local pages means, for my problem, anywhere on the client PC, not localhost.Here are the piece of code that I am inspired:

<script type='text/JavaScript'>function getXDomainRequest() { var xdr = null;  if (window.XDomainRequest) {  xdr = new XDomainRequest(); } else if (window.XMLHttpRequest) {  xdr = new XMLHttpRequest(); } else {  alert("Votre navigateur ne gère pas l'AJAX cross-domain !"); } return xdr; }var xdr = getXDomainRequest();xdr.onload = function() { alert(xdr.responseText);}xdr.open("GET", "http://www.foxycode.net/dev/ajax/XDomain_1.php ");xdr.send();</script>

Please, if U can, explain in simple words, I'm really a newbie in english.

Link to comment
Share on other sites

Sorry if it's because my poor english...I gonna try to explain that step by step:I have a html page with a JS script & some php scripts on my server.I want to invite the users to save this page on their pc.Then they will open this page and execute the JS functions contained in this page.Try my code, save it, for example, on your desktop & run it.On firefox & Chrome, no problem, it runs, but not on Internet Explorer (ACCESS DENIED)

Link to comment
Share on other sites

When I run the code you posted it works the same in IE8 and Firefox. Are you trying to double-click on the file and open it in IE, and then it fails? It should work if you access the file over HTTP, but when IE opens a local file it uses different security settings. You can't change the IE security settings in the code, you have to go into the Security options for IE and change what it is allowed to do.

Link to comment
Share on other sites

In IE, the settings you want to change are the security settings for the local zone. Play around with the options in there until you get it working like you want it to. Keep in mind that all of your users need to make the same changes in IE for your page to work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...