CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of utility
//Generate an object like "window.location"(href,protocol,host,hostname,port,pathname,search,hash)
//Or return false
function fnConvertHref(href) {
  var pattern = /([a-z]+):\/\/([^\/:]+):?([\d]*)\/?([^?]*)\??([^#]*)#?([^#]*)/gi;
 
  if (pattern.test(href)) {
    return {
      'href'     : href,
      'protocal' : RegExp.$1,
      'host'     : RegExp.$2 + RegExp.$3,
by yuyu1984   July 22, 2009 @ 4:28am
261 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate