URL Parser
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 URI
jQuery.uri.attr("host");
// Get the query string value for 'item' for the current page
jQuery.uri.param("item");
// Get the second segment of the URI of the current page
jQuery.uri.segment(2);
// Get the protocol of a manually passed in URL
jQuery.uri.setUri("http://allmarkedup.com/").attr("protocol") // returns 'http'
评论