bluetoother Posted October 21, 2007 Share Posted October 21, 2007 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 More sharing options...
Synook Posted October 22, 2007 Share Posted October 22, 2007 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 More sharing options...
bluetoother Posted October 22, 2007 Author Share Posted October 22, 2007 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 More sharing options...
justsomeguy Posted October 23, 2007 Share Posted October 23, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.