Ads 468x60px

Labels

Friday, January 22, 2016

Get current URL in Jquery and JavaScript.


Get current URL in Jquery and JavaScript?
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

2 comments:

  1. After going through your contents I realize that this is the best of my knowledge as it provides the best information and suggestions. This is very helpful and share worthy. If you are looking for the best What Is Qr Code And How Does It Work then visit Manju’s Tech Blog. Keep sharing more.

    ReplyDelete