URL Parser

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 - .

  1. // Get the domain name (host) from the current page URI 
  2. jQuery.uri.attr("host"); 
  3.  
  4. // Get the query string value for 'item' for the current page 
  5. jQuery.uri.param("item"); 
  6.  
  7. // Get the second segment of the URI of the current page 
  8. jQuery.uri.segment(2); 
  9.  
  10. // Get the protocol of a manually passed in URL 
  11. jQuery.uri.setUri("http://allmarkedup.com/").attr("protocol") // returns 'http' 

 

 

转载请注明:代码家园 » URL Parser

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)