Get current page URL and title with jQuery
Get current page URL and title with jQuery
HTML
<p>Current page URL: <span id="current_url">www.google.com</span>.</p>
<p>Current page title: <span id="current_title">mytitle</span>.</p>
JavaScript
jQuery(document).ready(function() {
var href = jQuery(location).attr('href');
var url = jQuery(this).attr('title');
jQuery('#current_title').html(href);
jQuery('#current_url').html(url);
});