function getOs(){ var OsObject = ""; if (navigator.userAgent.indexOf("MSIE") > 0) { return "MSIE"; } if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) { return "Firefox"; } if (isSafari = navigator.userAgent.indexOf("Safari") > 0) { return "Safari"; } if (isCamino = navigator.userAgent.indexOf("Camino") > 0) { return "Camino"; } if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) { return "Gecko"; } } function forbid(){ if(getOs() == 'MSIE'){ if(event.keyCode!=46){if(event.preventDefault)event.preventDefault();else event.returnValue=false;} } }
:onkeydown => "forbid();", :oncontextmenu => 'forbid();'