Robert Krimen has created a JavaScript URI Object capable of parsing, manipulating, and generating URIs. It splits up a URI into three objects: the URI, the path, and the query. Changes to the path or query objects are reflected in their respective URI. Armed with a wide array of methods, the b9j.uri object is well equipped to handle even the toughest of URIs.
Here's a overview of b9j.uri.URI from Robert:
- Parses using Steven Levithan's parseUri 1.2
- Easy path traversal (ascend to parent, descend to a child)
- Set or add to the URI query (with proper encoding), get/interrogate the query (with proper decoding)
- Add arbitrary data (unencoded) to the end of the query string, for extra flexibility
- Manipulate/interrogate the scheme, user information (username & password), host, port, fragment, and more in a piecewise fashion
- Add, change or strip the extension (html, js, css, ...) from a given URI
The code is available at http://appengine.bravo9.com/b9j/b9j.uri.js (19kb compressed / 5kb gzipped)
Delicious
Digg
StumbleUpon
Propeller
Reddit
Magnoliacom
Newsvine
Furl
Facebook
Google
Yahoo
Technorati
Icerocket
Recent comments
11 hours 47 min ago
1 day 12 hours ago
2 days 4 hours ago
2 days 8 hours ago
2 days 20 hours ago
2 days 22 hours ago
6 days 12 hours ago
1 week 2 days ago
1 week 2 days ago
2 weeks 9 hours ago