0

Is there some option to change a title of a webpage on a URL change - but ONLY when its URL changes?

There are some pages on the internet that constantly change their titles (for example YouTube) and add number of new notifications in front of the actual title. It's incredibly annoying.

I used this custom code that runs always when a page is loaded to block these stupid changes:

Object.defineProperty(document, 'title', {
  enumerable: false,
  configurable: false,
  writable: false,
  value: document.title
});

And it works - too well. The title never reloads again. The problem is with playlists - when new video loads (aka the URL of the panel changes), the title doesn't change. And it becomes confusing.

So, is there some way to walk around this? Thanks.

  • Make a setter that checks whether `window.location` has changed from the last time the setter was called. – SuperStormer Mar 01 '23 at 22:03
  • Many event handler solutions here - https://stackoverflow.com/questions/6390341/how-to-detect-if-url-has-changed-after-hash-in-javascript – imvain2 Mar 01 '23 at 22:49

0 Answers0