I need to prevent the user from being able to press CTRL and plus to zoom out or minus for zooming in.
Is there any way of doing it ?
I need to prevent the user from being able to press CTRL and plus to zoom out or minus for zooming in.
Is there any way of doing it ?
if you want to prevent zooming in general (also with ctrl + mouseweel and touch-gestures on portable devices) you can simply add a meta-tag:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
note that this could be disabled by browser-settings or -plugins and most desktop-browsers don't notice it anyway. the meta-tag can also be deleted using the dev-tools built in to most modern browsers.
it's not 100% safe - this just prevents your users from "accidently" zooming on your site.
No, that cannot be prevented as that's happening at the browser level. It's not doing anything to your code -- it's simply telling the browser to scale whatever it's rendering to xx% of its normal size when it displays it. You cannot control what the browser does with your page once it's rendered it -- you can only control what you provide it to render.
You can try to block the key on your website using javascript
document.onkeydown = function (e) {
if (e.keyCode === 17) {
//alert('your alert here');
return false;
}
};
the keycode is:
ctrl = 17
[+] (num) = 107
[-] (num) = 109