Short tip: URL class in JavaScript

This is a custom class for JavaScript, that makes parsing of a URL easier. It is a ”port” of my URL class for LotusScript, and can be used like this:

var url=new URL(’http://joe:pwd@server/ix.html?arg=value#ref’);

alert(’url:’+url.toString());

alert(’port:’+url.getPort());

alert(’query:’+url.getQuery());

alert(’protocol:’+url.getProtocol());

alert(’host:’+url.getHost());

alert(’user:’+url.getUserName());

alert(’password:’+url.getPassword());

alert(’port:’+url.getPort());

alert(’file:’+url.getFile());

alert(’reference:’+url.getReference());

alert(’path:’+url.getPath());

alert(’argumentvalue:’+url.getArgumentValue(’arg’));

alert(’all arguments:’+url.getArgumentValues());

I have corrected the url.js file, so that URLs without any reference (#) part now works correctly.