What are your recommendations for JavaScript URL manipulation library / API
Specifically, I would like to
Extract URL parameters out of a URL string. Ideally, would reflect into a JS object.
Form URL parameter strings (ideally from a JS Object).
What are your recommendations for JavaScript URL manipulation library / API
Specifically, I would like to
Extract URL parameters out of a URL string. Ideally, would reflect into a JS object.
Form URL parameter strings (ideally from a JS Object).
This one is straightforward: http://adamv.com/dev/javascript/querystring
If you have a Querystring
object qs
, you can use qs.params
to get a raw JavaScript object.
I've needed this over and over again. Even though there are lots of good parsers, and lots of good query string manipulators, I still found myself haphazardly reconstructing URLs by pasting pieces together.
To scratch this itch, I wrote jsUri: http://code.google.com/p/jsuri. Solid parsing, fluent manipulation and restringification. Enjoy!