简体   繁体   English

如何在网页中设置窗口标题

[英]how to set window title in a webpage

有没有一种可能的方法来设置文档窗口标题。我有一个网页,在该网页中,我们正在加载Iframe(来自另一个项目)。默认情况下,它是采用当前网页的标题。 iframe页面标题。

I think this is what you are looking for. 我认为这就是您想要的。 Get the title for the iframe in whatever manner works best for you and then set the document title using: 以最适合您的方式获取iframe的标题,然后使用以下方法设置文档标题:

document.title = "New Title"

If you don't know how to get the iframe title, try something along these lines: 如果您不知道如何获取iframe标题,请尝试以下方法:

document.title = document.getElementById("main-content-iframe").contentDocument.title;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM