admin管理员组文章数量:1313121
I am have been reading material on JavaScript and there are two ways of accessing the title
of the page:
- The
window.title
property - The
document.title
property
But when applying, the second only works. I am unable to understand why there are two titles and why both of them don't work.
I am have been reading material on JavaScript and there are two ways of accessing the title
of the page:
- The
window.title
property - The
document.title
property
But when applying, the second only works. I am unable to understand why there are two titles and why both of them don't work.
Share Improve this question asked Jun 19, 2013 at 1:40 M. Ahmad ZafarM. Ahmad Zafar 4,9394 gold badges34 silver badges45 bronze badges 3-
There aren't.
window.title
is not a universal property, whereasdocument.title
is. Fire up you're browser's console, and type "window.t" and see what it tries to autoplete with. There will be no "title" in that list. – Mike 'Pomax' Kamermans Commented Jun 19, 2013 at 1:44 -
Is
window.title
a depreciated property then? – M. Ahmad Zafar Commented Jun 19, 2013 at 2:04 -
2
document
is inwindow
:window.document.title
is the same asdocument.title
– elclanrs Commented Jun 19, 2013 at 2:04
1 Answer
Reset to default 10window.document.title
is correct.
window.title
is incorrect, because the window
object doesn't have a title
property (all the properties of window are down the left side, you'll see title
isn't there).
本文标签: javascriptDifference between windowtitle and documenttitleStack Overflow
版权声明:本文标题:javascript - Difference between window.title and document.title - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741934041a2405743.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论