How to get current url path example in Jquery?

By Hardik Savani | July 27, 2016 | Category : Javascript jQuery

Sometimes we need to get current URL in jquery file, we can get current URL or path of our current page in javascript using "window.location".

In this post i give you three way to get current url in your js file as there are bellow listed:




Ok, so you can check bellow example code and run in your system.


<html lang="en">


<title>JQuery - get current URL Example</title>

<script src=""></script>



<script type="text/javascript">

var currentURL = window.location.href;


var currentURL = $(location).attr("href");


var currentURL = window.location;





Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: