Menu

How to get current URL with jQuery?

Written by

http://www.domain.com:8082/index.php#tab2?foo=123

Property Result
host www.domain.com:8082
hostname www.domain.com
port 8082
protocol http:
pathname index.php
href http://www.domain.com:8082/index.php#tab2
hash #tab2
search ?foo=789

var x = $(location).attr(‘<property>’);

Article Categories:
Javascript · jQuery Plugins

Comments are closed.

Shares