Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to extract page name from complex URL
  2. var url = "http://www.domainname.com/somepage.php?c=innerContent";
  3. var temp = url.split("?")[0].split("/");
  4. var pageName = temp[temp.length - 1];
  5.        
  6. var xlastPart = window.location.pathname.split("/").pop()
  7.        
  8. var lastPart = jQuery("a:eq(3)").attr("pathname").split("/").pop()