var currentPageUrl = ""; if (typeof this.href === "undefined") { currentPageUrl = document.location.toString().toLowerCase(); }else { currentPageUrl = this.href.toString().toLowerCase(); }