How to get current html page title with javascript

I'm trying to get the plain html page title with javascript.

I use firefox and with


I get extra "- Mozilla Firefox" to the end of the title. I know it would be easy to get rid of this by modifying string but if they change text, use different format etc or some other browser modifies this differently I have extra text there again.

So, is there any cross browser way to get the plain tag content with javascript? Jquery solution is ok.



One option from DOM directly:


Tested only on chrome & IE9, but logically should work on all browsers.

Or more generic

var title = document.getElementsByTagName("title")[0].innerHTML;

try like this


Like this :

jQuery(document).ready(function () {
    var title = jQuery(this).attr('title');

works for IE, Firefox and Chrome.


returns all the title

but if you just want the page title then use



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.