1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Javascript meta change from with in frame

Discussion in 'JavaScript' started by Ivo Barros, Sep 20, 2010.

  1. #1
    I have this problem to solve:

    • mainsrc.html is loaded into a frame in a frameset in secsrc.html
    • I can only change mainsrc.html
    • I have to add a meta to the head of secsrc.html

    Is this possible through javascript?

    the script that I have so far is below, its located in mainsrc.html body, as you can see this doesnt work as it just adds the meta to mainsrc.html's head and not secsrc.html's head:

    ...
    <script type="text/javascript">
    if (document.createElement &&
    (meta = document.createElement('meta'))) {

    meta.name = "dummy";
    meta.content = "1234";

    document.getElementsByTagName('head').item(0).appendChild(meta);
    }
    </script>
    ...
     
    Ivo Barros, Sep 20, 2010 IP