简体   繁体   中英

The document.title is NOT Document <title>

ok, this is weird, and I like to have an idea if this is possible

eg

the page

<title>12345</title>

then if js is if(document.title=='12345')...

I guess this must be true, BUT my counter tells me otherwise, 10% is NOT (most in IE)

So I like to know, is there any browser plugin or other stuff does this and make document.title is NOT <title>

Try logging what document.title is if it isn't '12345' .

The most likely thing is if the file is being transferred with chunked encoding (a common feature in HTTP/1.1) then the <title> tag may be split in half and this would cause an incorrect title to show up.

This can be fixed by adding:

window.onload = function() {document.title = document.getElementsByTagName('title')[0].firstChild.nodeValue;};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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