Summary
var p = new Poly9.URLParser('http://user:password@poly9.com/pathname?arguments=1#fragment');
/* OUT *
p.getHost() == 'poly9.com'
p.getProtocol() == 'http'
p.getPathname() == '/pathname'
p.getQuerystring() == 'arguments=1'
p.getFragment() == 'fragment'
p.getUsername() == 'user'
p.getPassword() == 'password'
*/
p.setURL('another.url.com');
/* OUT *
p.getHost() == 'another.url.com'
p.getProtocol() == ''
*/
Reference
URLParser - Public code - Trachttps://code.poly9.com/trac/wiki/URLParser
via
phpspot開発日誌 - 2006-11-27 - JavaScriptから使える便利なURLパーサークラス「URLParser」http://phpspot.org/blog/archives/2006/11/javascripturlur.html