I need to display some data(some text message) from a URL*(an HTML file)* which is in a different domain. I thought about using an iFrame to display the markup. Now the problem could be
if that site is down, then I wil see 404 error in that iFrame. i want to avoid that. I thought about using dojo to make an AJAX call to that URL to get the response, use innerHTML
to insert the response to the DOM. This is all what I need. But due to cross domain AJAX issues, I don’t think it is possible. We are using dojo in our application. I searched
in Google to find a good implementation of Cross Domain scripting using Dojo. All I found is stuffs like JSONP. I don’t want to make the remote domain return a JSONP. It is
just an HTML file and that file contains the markup that I need to print to the console. Can someone suggest a good way to do this.
I need to display some data(some text message) from a URL* (an HTML file)
Share
Sadly as was already mentioned by Nakul in the comments, the same-origin policy does not allow for cross-domain XHR requests (at least in a cross-browser way).
The workarounds involve either cooperation from the cross-domain site (JSONP, CORS, various iframe communication tricks) or setting up a proxy in your own server so that all “cross-domain” go through your own domain first.