diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)

Nov252006

Poly9’s Polyvalent Javascript URL Parser

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:[email protected]/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

Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...