Sometimes, we need to access the current URL in our JavaScript/JQuery code. We need to get any query string value or we need to check URL for any specific value/sub domain. There are a lot of situations when we want to fetch current URL in our code. There are several ways to do this. Here, I am discussing some of them. I will use the below URL to test the output. http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2 Using classical JavaScript: Property Result ================================================================================= window.location http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2 window.location.href http://www.mysite.com/abc.aspx?qs1=test1&qs2=test2 window.location.pathname ...
I love Programming, and Eager to learn New things Curious about Microsoft Products, Interested in Knowledge sharing. If you can dream IT, You can become it, If you can think IT, You can do IT, If you can believe it, you can achieve IT.