[英]Disable “backspace” key across app in EmberJs
Is there a way in EmberJs to disable the backspace
key, so it doesn't navigate back in the browser history? EmberJs中是否可以禁用
backspace
键,因此它不会在浏览器历史记录中回退?
Currently using EmberJs 2.0
当前正在使用
EmberJs 2.0
I did find this possible answer: 我确实找到了这个可能的答案:
https://stackoverflow.com/a/1235723/1913888 https://stackoverflow.com/a/1235723/1913888
But one trick to this, is that a backspace
action should work for example in an input box, but not for navigating back in the window history. 但是,这样做的一个窍门是,例如,
backspace
操作应该在输入框中起作用,而不是在窗口历史记录中导航。
Thank you 谢谢
In my app, I just listen for the keydown and check to see if it is triggered on the body. 在我的应用程序中,我只听按键按下并检查是否在主体上触发了它。
$(window).on("keydown", function(evt){
if (evt.keyCode===8 && evt.target.nodeName==="BODY") {
evt.preventDefault();
}
});
Other option is to check to make sure the target is not an input/content-editable. 另一种选择是检查以确保目标不是输入/内容可编辑的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.