I am creating a JavaScript bookmarklet that dynamically update开发者_开发技巧s the title bar, but it doesn't display the changes in IE (I've tried IE7 and IE8). Here's a simplified example that demonstrates my issue:
javascript:document.title='new title';alert(document.title);
Notice that the the value is updated in the alert, but not on the title bar or tab. It is working fine for me in Chrome.
It's a bug in IE. It's possible to work around it by changing the URL's fragment identifier ("hash"), which may or may not be feasible for your purpose:
javascript:document.title='foobar';location.replace('#'+new Date().getTime())
new Date().getTime()
is used to get a unique number that is unlikely to be used as a name or ID anywhere in the page (so that the page does not actually scroll).
From my experience most browsers will update the new TITLE in the browser window or tab.
However it seems with IE browsers they only set it one time and then that's it - no further updates. If thats true (would love to see a solution as well) then there is no way around it.
精彩评论