How can I check if a URL has changed in JavaScript? For example, websites like GitHub, which use AJAX, will append page information after a # symbol to create a unique URL w
window.addEventListener("beforeunload", function (e) { // do something }, false);