How to detect that Ctrl+R was pressed?

后端 未结 10 848
逝去的感伤
逝去的感伤 2020-12-08 14:27

I\'m coding a function in jquery that executes if Ctrl+R is pressed but I can\'t seem to find out what the left and right ctrl keycodes are... Can some

10条回答
  •  抹茶落季
    2020-12-08 15:06

    This is the code I'm using to disable refresh on IE and firefox (This works well for F5, Ctrl+F5 and Ctrl+R)

    
    

    If you don't want to use useragent to detect what type of browser it is ($.browser uses navigator.userAgent to determine the platform), you can use

    if('MozBoxSizing' in document.documentElement.style) - returns true for firefox

提交回复
热议问题