• 0

Cross-Domain Javascript


Question

Simple problem, Im trying to make a file uploader using javascript and an iframe but im getting security exceptions whenever i try to access anything inside the iframe .

Is there any way to trick my browser into thinking that the document is running on a domain and not localy or a way to bypass these security exceptions.

function GetID() {
	alert('ID ' + document.iframe.uploaderform.url.value)
	document.iframe.uploaderform.url.value = 'the url';
}

This is the function im trying to run.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

If the content of the iframe is not from the same domain as the context in which your script is executing, the browsers Same Domain policy kicks in and says no, this is by design. You can't bypass this im afraid, is there an alternative way you can implement this, possibly with a callback to the server?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.