javascript - How do I prevent a page and tab's document.title from changing? - Stack Overflow

Some pages change their document.title, which appears in the page's tab, when certain events occur

Some pages change their document.title, which appears in the page's tab, when certain events occur. It can be confusing to have a tab with ever-changing names, so I want to prevent it from changing. How to do this?

Some pages change their document.title, which appears in the page's tab, when certain events occur. It can be confusing to have a tab with ever-changing names, so I want to prevent it from changing. How to do this?

Share Improve this question asked Apr 20, 2016 at 10:26 Protector oneProtector one 7,3495 gold badges67 silver badges88 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

You can use javascript to define a property on the document object with name title and a non-functional setter.

Object.defineProperty(document, 'title', {
  set: function(){}
});

You could execute this in the Developer console, put it in the address bar as a single line prepended by "javascript:", or you could put it in a user script or extension if you want it to be executed every time.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743765836a4503471.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信