How to change window title from a frame in javascript?

前端 未结 2 1771
梦毁少年i
梦毁少年i 2020-12-06 17:53

I hosted my web app on a freehoster service which shows my webpage in a frameset. 2 frames are there. In the top narrow frame there are their ad and the bottom frame is mine

相关标签:
2条回答
  • 2020-12-06 18:53

    use top.document.title (top refers to the top most window within the browser)

    0 讨论(0)
  • 2020-12-06 18:54

    Yes, but it has to be on the same domain (and use a relative url for a path)

      window.parent.document.title = "Your new title";
    

    If the iframe/frame is on a different domain, then you'll get a permission denied error.

    0 讨论(0)
提交回复
热议问题