I\'m trying to get the plain html page title with javascript.
I use firefox and with
document.title
I get extra \"- Mozilla Firef
try like this
$('title').text();
One option from DOM directly:
$(document).find("title").text();
Tested only on chrome & IE9, but logically should work on all browsers.
Or more generic
var title = document.getElementsByTagName("title")[0].innerHTML;
Like this :
jQuery(document).ready(function () {
var title = jQuery(this).attr('title');
});
works for IE, Firefox and Chrome.
$('title').text();
returns all the title
but if you just want the page title then use
document.title