JavaScript
Article
By Sam Deering

jQuery Get Current Page Title

By Sam Deering
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

jQuery code snippet to get the current web page full title and store it in a variable for use with other scripts. This is the title you see on your browser header.

Current page title: mytitle.

--ADVERTISEMENT--

Another way suggested by Andy.

var current_href = $(location).attr('href');
var current_title = $(document).attr('title');
Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the latest in JavaScript, once a week, for free.