Change Web Browser Title with Javascript

Every web browser has a title at the top of the page and is specified in HTML. By default, the the title tag is located in the header of the HTML. Despite the default in HTML, it is possible to change the default title name with javascript. Below is a the basic snippet of javascript code that changes the current Web Browser title to “The Web Page title has been changed“.

document.title = "The Web Page title has been changed"

In the live demo below, the above snippet is inserted into the onclick event of an html input button. Before clicking the button below, note the current browser window title.

After clicking the button above, you will notice that the web browser title has been changed to The Web Page title has now been changed. Below is the actual code on how the button was created.

<input type="button" onclick="document.title='The Web Page title has been changed'" />
Share and Enjoy:
  • Digg
  • DotNetKicks
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • MySpace
  • Netvibes
  • Reddit
  • StumbleUpon
You can leave a response, or trackback from your own site.

5 Responses to “Change Web Browser Title with Javascript”

  1. Mike says:

    I have just created my website and have beeen trying to get it optimised, however I have been informed the the title at the top left of the browswer is important and I am not sure how or where I go to change that.
    Please can you help me or point me in a direction that will assist me.
    Thankyou

  2. It is a pity that you can not remove the name of the browser’s title

  3. skube says:

    I have a problem getting accents to render properly using this technique.

  4. Hey says:

    cool site <3

  5. Ronnie Tritt says:

    Hi, I came across this blog article while searching for help with JavaScript. I’ve recently switched browsers from Opera to Mozilla Firefox 3.1. Now I seem to have a issue with loading JavaScript. Every time I go on a page that requires Javascript, the site doesn’t load and I get a “runtime error javascript.JSException: Unknown name”. I can’t seem to find out how to fix it. Any help is very appreciated! Thanks

Leave a Reply