current url with window object code example
Example 1: javascript get current url
var currentUrl = window.location.href;
Example 2: get actual url in variable
var currentLocation = window.location;
var currentUrl = window.location.href;
var currentLocation = window.location;