How to change window title from a frame in javascript?

前端 未结 2 1783
梦毁少年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: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.

提交回复
热议问题