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…
The
locationobject is what you’re after for the URL piece:And for the title,
document.title: