How to disable CTRL key combinations on your webpages?

How to disable CTRL key combinations on your web pages? [STEP BY STEP]☑️

Here in this tutorial, we will explain you how to disable CTRL key combinations on your webpages.

Video Tutorial– “How to disable CTRL key combinations on your webpages?”

Follow the steps to disable CTRL key combinations on your web pages:

Step::1 Login to your cPanel interface

How to disable CTRL key combinations on your webpages

Step::2 Click on the File Manager icon under the Files section

How to disable CTRL key combinations on your webpages

Step::3 Go to public_html

How to disable CTRL key combinations on your webpages

Step::4 Create a .html file. with any name like test.html or control.html

How to disable CTRL key combinations on your webpages

Step::5 Once the file is created, right-click over the file and choose the Edit option

How to disable CTRL key combinations on your webpages

Step::6 Enter the code given below

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Disable Ctrl Key Combinations </title>
<script language="JavaScript">
function disableCtrlKeyCombination(e)
{
//list all CTRL + key combinations you want to disable
var forbiddenKeys = new Array('a', 'n', 'c', 'x', 'v', 'j' , 'w');
var key;
var isCtrl;
if(window.event)
{
key = window.event.keyCode; //IE
if(window.event.ctrlKey)
isCtrl = true;
else
isCtrl = false;
}
else
{
key = e.which; //firefox
if(e.ctrlKey)
isCtrl = true;
else
isCtrl = false;
}
//if ctrl is pressed check if other key is in forbidenKeys array
if(isCtrl)
{
for(i=0; i<forbiddenKeys.length; i++)
{
//case-insensitive comparation
if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase())
{
alert('Key combination CTRL + '+String.fromCharCode(key) +' has been disabled.');
return false;
}
}
}
return true;
}
</script>
</head>
<body onkeypress="return disableCtrlKeyCombination(event);" onkeydown="return disableCtrlKeyCombination(event);">
Press ctrl and you can check various key is disable with CTRL. like — 'a', 'n', 'c', 'x', 'v', 'j' , 'w' Just add key in above the array and disable key as you want.
</body>
</html>

How to disable CTRL key combinations on your webpages

Step::7 Save the file by clicking on Save changes

How to disable CTRL key combinations on your webpages

Now try to open that particular page where you have added the code and verify that it’s working or not…

How to disable CTRL key combinations on your webpages

In this way, you could disable CTRL key combinations on your web pages.

Thanks for reading this article !!! We hope this was helpful to you all.

For more information, kindly follow us on social media like Twitter and Facebook, and for video tutorials, subscribe to our YouTube channelhttps://youtube.com/redserverhost

Facebook Page https://facebook.com/redserverhost

Twitter Pagehttps://twitter.com/redserverhost

If you have any suggestions or problems related to this tutorial, please let us know via the comment section below.

Tags: cheap linux hostingbuy linux hostingcheap reseller hostingbuy reseller hostingbest reseller hostingcheap web hostingcheapest web hostingcheapest reseller hosting,  cheap reseller hostcheap linux hostcheapest linux hostingbest linux hostingbest web hosting

Scroll to Top