javascript detect leaving page code example Example: javascript detect page if ( document.URL.includes("homepage.aspx") ) { //Code here }