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