Wednesday, March 27, 2013

get and split url using javascript


<script>
function getPathFromUrl() {
  var url = window.location.href;


  if(url.indexOf("html") != -1)
     url = url.split(".")[0];

window.location.href;


  //return url;
}
$("#a").click(function(){
     alert(getPathFromUrl());//this will alert the url without querystring
});
</script>

No comments:

Post a Comment