Способ AngularJS - скрипка здесь: http://jsfiddle.net/PT5BG/4/
Parse URL using AngularJS
Parse URL using AngularJS
url:
- href = {{parser.href}}
- protocol = {{parser.protocol}}
- host = {{parser.host}}
- hostname = {{parser.hostname}}
- port = {{parser.port}}
- pathname = {{parser.pathname}}
- hash = {{parser.hash}}
- search = {{parser.search}}