有没有一种方法可以通过使用JavaScript从框架中的页面更改index.html的标题

Is there a way to change the title of index.html from page in the frame by using JavaScript?

本文关键字:框架 标题 html index JavaScript 一种 方法 可以通过 有没有      更新时间:2023-09-26

可能重复:
如何在javascript中更改框架中的窗口标题?

在我的index.html文件中,我有3个框架。

我想从框架中的一个页面更改index.html的标题。

使用JavaScript怎么能做到这一点?

是的,但它必须在同一个域上(并使用相对url作为路径)

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

如果iframe/框架在另一个域上,则会出现拒绝权限错误。

如果上述操作失败,请使用

使用top.document.title(顶部指浏览器中最顶部的窗口)