Get current URL in Jquery and JavaScript?
My url is http://www.rohitazad.com:4545/index.php#tab5?foo=890
My url is http://www.rohitazad.com:4545/index.php#tab5?foo=890
In Jquery
Property Result
______________________________________________
host www.rohitazad.com:4545
hostname www.rohitazad.com
port 4545
protocol http:
pathname index.php
href http://www.rohitazad.com:4545/index.php#tab5
hash #tab5
search ?foo=890
var locationWindow = $(location).attr('property');
In JavaScript
window.location.host www.rohitazad.com:4545
window.location.hostname www.rohitazad.com
window.location.port 4545
window.location.protocol http:
window.location.pathname index.php
window.location.href http://www.rohitazad.com:4545/index.php#tab5
window.location.hash #tab5
window.location.search ?foo=890