2014-10-11 32 views
1

对于使用title参数的浏览器,我们应该使用什么值告诉浏览器使用其默认值?如何为history.pushState和replaceState设置“默认”值?

在Safari 5.1.7(7534.57.2),如果我把nullundefinedtitle PARAM,它使用浏览器的默认:

enter image description here

然而,歌剧 12.16分别使用字符串"null""undefined"

enter image description here

什么应该是“正确的”行为?

在Opera上,如果"null""undefined"不起作用,我们如何设置为“默认”?

MDN's History docs似乎并未有任何关于History.pushState/replaceState的参数允许值多的信息。)

回答

0

不知道是否有将其设置为默认标题的具体方式,但安全应在所有浏览器的工作方式标题设置为location.href

document.title = location.href; 
+0

浏览器可显示在其他方面称号不是简单地用'location.href'。例如。一个自定义,它将'location.href'前面加上一个值,或者只显示域而不显示路径。 – Pacerier 2014-10-11 15:59:04

+0

确实,但我不知道有什么方法将它设置为“默认” – orhanhenrik 2014-10-11 16:00:21