Jump to content

Permission denied to call method XMLHttpRequest.open


bluetoother
 Share

Recommended Posts

any body got this javascript error before :Permission denied to call method XMLHttpRequest.openiam developing ads system that bring data from pages from out side the domain where the ajax request started

xmlHttp.open("GET","http://www.any-site.com/ad_system.php?url="+document.domain+"&pgid="+Math.random(),true)

it work like this

xmlHttp.open("GET","ad_system.php?url="+document.domain+"&pgid="+Math.random(),true)

is there any other way to get data from pages out side the domain ?

Link to comment
Share on other sites

You will have to use iFrames - you can't use the xmlHttpRequest object to call pages from other domains.

Link to comment
Share on other sites

you are righti found that if i want to insert ad using javascript i have to use framenow i have this issue with framesi use this code to create iframe in a page

ifrm = document.createElement("IFRAME");   ifrm.setAttribute("src", "http://www.site.com/ad_system.php?url="+document.domain);   ifrm.setAttribute("frameborder", "0");   ifrm.style.width = 250+"px";   ifrm.style.height = 100+"px";   document.appendChild(ifrm);

but i find it inserted in the bottom of the pagei want the iframe to be inserted in the same place where this code calledknow how ?

Link to comment
Share on other sites

When you use document.appendChild it will append (add) the element to the end of the document. If the element already exists in the document, it will move it to the end. Instead of using document for the appendChild use the container of whatever holds the iframe.

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...