Javascript Intercepted “Ctrl+O” Does Not Open My File Dialog

后端 未结 4 1533
粉色の甜心
粉色の甜心 2021-01-18 05:12

I have an file-browser input in my HTML.

I have another button with ID choose-file-button

4条回答
  •  清酒与你
    2021-01-18 05:54

    Browser map many Ctrl+ shortcuts to own commands, for instance CTRL+O to open a file (in firefox).

    On the same time browser behave different when you try to override such shortcuts in javascript. Some browsers allow you to do so, some don't, and sometimes the default browser action may pop up together with the action of your javascript.

    Here is another thread discussing this topic.

    Probably the best you can do is to choose a different shortcut.

提交回复
热议问题