November 25, 2006
5:42 pm | Last updated: November 25, 2006 at: 6:55 pm

Denis Laprise and the Poly9 Group created the Polyvalent Javascript URL Parser, a very robust URL parser in JavaScript. Get the js file, the test suite or checkout the latest SVN revision with svn co https://code.poly9.com/repo/urlparser (username/password: guest/guest)

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() == ''
*/

p.setURL('dsdsad'); // throws an exception

poly9 | ajaxian

Poly9's, Polyvalent, Javascript, URL Parser

Loading

Contextual Related Posts:

No followup yet

Leave a Response

Comment Preview
« How To Subclass The JavaScript Array ObjectAdSense at San Jose SES Video Showing Optimization Tips »
Feed Icon

Subscribe via RSS or email: