URL Parser
June 13, 2008 - 12:43am — allmarkedup
Parses URLs and provides easy access to information within them, such as the protocol, host, port, the segments that make up the path and the various query string values. The parser is based on the Regex URI parser by Stephen Levithian - http://blog.stevenlevithan.com/archives/parseuri.
// Get the domain name (host) from the current page URL
jQuery.url.attr("host");
// Get the query string value for 'item' for the current page
jQuery.url.param("item");
// Get the second segment of the URL of the current page
jQuery.url.segment(2);
// Get the protocol of a manually passed in URL
jQuery.url.setUrl("http://allmarkedup.com/").attr("protocol") // returns 'http'Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 1.0.1 | 2008-Aug-29 | 7.97 KB | Recommended for 1.0.x | ||
