00 Votes

JavaScript: Change Page Title in Browser dynamically

Tip by Anja Proggy | 2013-11-08 at 03:06

If you want to change the title of a website dynamically using JavaScript, you can just use this simple line:

<script type="text/javascript">
  document.title = 'My New Title';
</script>

You only have to set a string to "document.title" and the title shown in the browser is changing.

Please note: it is not a good idea to use this function for search engine optimization (SEO) reasons, because most search engines are ignoring JavaScript, so that this script does not have any effect. But of course, you can use the script to give users a better orientation when dynamically changing the content of the web page.

ReplyPositiveNegative

About the Author

AvatarThe author has not added a profile short description yet.
Show Profile

 

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.