get URL, get Title by Javascript not jQuery

get, javascript, jquery, title, url

Solution

The `location` object is what you're after for the URL piece:

var currentURL = window.location.href;

And for the title, `document.title`:

var title = document.title;

Problem

Does anyone know how to get url and title of the current page by using Javascript without jQuery!? ``` <script type="text/javascript"> var title = document.getElementsByTagName('title')[0].innerHTML; var url = document.location.href socializ(encodeURIComponent('+href+'),encodeURIComponent('+title+')) </script> ``` Just doesn't work.. need help...

Original source