开发者

How do I prevent safari from using the command key other than how I specified it in my javascript?

At the moment, my code uses the command key in combination with other keys to call functions within our javascript. This functionality currently works within firefox, however in safari by pressing combinations such as command + "+" or command + "1" it does not do the intended functionality and instead does the functionality inherent to the browser. I am currently using开发者_如何学C the preventDefault() function, which is why this works in firefox, but I am not sure what this does not work in safari. Any ideas?


I have never been able to convince Safari to let me control command 1 through 9, but event.preventDefault() seems to work fine on - and = when binding to keydown. The normal zoom in/out are suppressed as expected.


Try this:

        if (event.preventDefault) {
           event.preventDefault();
        }
        if (event.stopPropagation) {
            event.stopPropagation();
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜