原生JavaScript获取当前页面路径

var currentPageUrl = "";
if (typeof this.href === "undefined") {
    currentPageUrl = document.location.toString().toLowerCase();
}
else {
    currentPageUrl = this.href.toString().toLowerCase();
}
原文地址:https://www.cnblogs.com/shaoing/p/5358614.html