Some websites made with SquareSpace (for example this website) redirect the user to the login page when ESC
is pressed. How can I prevent this redirection? (I am not the owner of this website so I can't disable this feature in the Website Settings)
This is what I tried but this doesn't prevent the redirection from happening:
if (document.getElementsByTagName("head")[0].innerHTML.includes("squarespace") ==true){
window.addEventListener("keydown", dispatchkeyboardSquareSpace);
function dispatchkeyboardSquareSpace(key) {
if (key.key == "Escape") { ///66 = b https://keycode.info/
console.log("escape neutralized because squarespace")
};
}
}
CodePudding user response:
Try this (it should be self explanatory):
Static.SQUARESPACE_CONTEXT.websiteSettings.useEscapeKeyToLogin = false;