stopping key event bubbling in safari 4 windows

一笑奈何 提交于 2019-12-14 02:13:48

问题


In safari 4 windows, it does not seem possible to stop some key events from bubbling up to the browser in javascript.

This guy got pounced on for trying to stop F5 (a dubious design goal), but the technical problem remains... how do you stop certain key events from bubbling up in Safari 4? For example,

You can stop:

  • CTRL+T
  • CTRL+N

You cannot stop:

  • CTRL+F
  • F5

回答1:


Interesting. My tests gave the same results as yours: I couldn't find a way to prevent the default action of CTRL+F in Safari 4 in Windows, which suggests it's a deliberate design decision. However, I did discover the probably useless fact that putting an alert in my keydown event handler prevented the search bar from appearing, regardless of whether I then cancelled the event default action.



来源:https://stackoverflow.com/questions/1678273/stopping-key-event-bubbling-in-safari-4-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!