You make a good point.
I was actually dealing with some urls today that were really annoying.

I had to check the platform and redirect to a different page. That should be pretty easy, but isn't.

Give me something that I can use with window.location or a .go() method (of whatever name) and I'm sold. I don't care if it extends string or not. Ideally I wouldn't like the idea of it constantly reparsing a string, but it doesn't really matter to me from an end-user perspective.

var url = new URL();
// defaults to window.location

if (mac) url.set('basename', defaultBasename + '-mac').go();
// whatever means the bit at the end of the "path" before the extension
if (win) url.set('filename', '').go(); // EG: mydomain.com/dir/index.html -> mydomain.com/dir/

Anoyone who can give me something to this effect without forcing me to deal with slashes and file extensions wins a thumbs-up. I don't care about method names or subclassing or whatever. Just give me the goods! :D

— Thomas Aylott / SubtleGradient.com

Sebastian Markbåge wrote:
To me, the purpose of a URI class is so that we DON'T
have to deal with string manipulation.

Aaron, could you perhaps fill me in on a few concrete URI manipulation
scenarios where it would be more beneficial to have string
functionality?

On Mar 12, 8:06 pm, Thomas Aylott / subtleGradient
<[email protected]>  wrote:
I think this is best.
Let's rename URI ->  URL (or even String.URL ideally) and we can spend
some time doing a "proper" URI class also.

— Thomas Aylott / SubtleGradient.com

Reply via email to