Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorMcChicken
    • CommentTimeDec 5th 2006
     permalink
    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();
    }
    • CommentAuthorneXus
    • CommentTimeDec 11th 2006
     permalink
    For security purposes this make complete sense..

    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.
Add your comments
    Username Password
  • Format comments as (Help)