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.
<title>JQuery - get current URL Example</title>
var currentURL = window.location.href;
var currentURL = $(location).attr("href");
var currentURL = window.location;