URL Parser

联合创作 · 2023-10-02 14:50

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'
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报