Showing custom text on the taskbar browser tab

12,655

Solution 1

The contents of the title could either be set by the default HTML originating from the server-side in the <title></title> element, or it could be set using the document.title property in Javascript.

Solution 2

Well you answered most of this question yourself.

The missing piece of the puzzle is that you can change the page title dynamically using javascript:

document.title = "(2) New title"
Share:
12,655
Istiaque Ahmed
Author by

Istiaque Ahmed

A programmer anyway

Updated on June 05, 2022

Comments

  • Istiaque Ahmed
    Istiaque Ahmed almost 2 years

    For example suppose you have 3 notifications in Facebook.

    When you open the website, you see a browser tab (?) on the taskbar showing '(3) Your name' in Chrome or '(3)Facebook- Mozilla...' in Firefox.

    For a webpage, the title value (plus browser dependent text) is shown as text in the browser tab and on the taskbar.

    How can I add the number of notifications (i.e. 3 here) there? Is it done with HTML, JavaScript or what?