Hi there, I would like to get elements from another window I open, but I can't seem to get it to work. It would be something like that (in this example, I try to get all anchor links from CSSBeauty homepage) :
var myWin = window.open("http://www.cssbeauty.com"); myWin.onload = function() { var links = myWin.document.getElementsByTagName("a"); alert(links.length); window.close(); }
Have a look at the error your code generates > "uncaught exception: Permission denied to set property Window.onload"
You're getting this error because your script does not reside on the same domain as www.cssbeauty.com & you therefor cannot access/set properties to elements residing on that domain. If you could then spoofing any website would be all too easy. So essentially you can only access the DOM for popups/frame content etc. that reside on the same domain as the script that you're trying to access them from.