Introduction
In our web application sometimes we require current page URLl
on client side, like when we share any script or perform any action according
to the page name.
Using the code
Here I am sharing the demo code to get the current
page URL using JavaScript:
var currentPageUrl = "";
if (typeof this.href === "undefined") {
currentPageUrl = document.location.toString().toLowerCase();
}
else {
currentPageUrl = this.href.toString().toLowerCase();
}
Points of Interest
The above code works perfectly with popups also.