5 April 2012

This shows you how to get the path of the current URL and assign it to a variable. This is achieved by taking url from location object. The location object also has other properties, like host, hash, protocol, and pathname.

Source code viewer
  1. var url = jQuery(location).attr("href");
Programming Language: jQuery