How to disable selection on your webpage?

0
35

Today in this tutorial we will learn how to disable selection on your webpage.

Follow the steps to disable selection on your webpage:

Step::1 Login to your cPanel and click on File Manager

How to disable selection on your webpage

Step::2 Go inside public_html and create a new file i.e “testing.html” You can create a new html file with any name.

How to disable selection on your webpage

Step::3 Right click over the newly created file and choose the Edit option

How to disable selection on your webpage

Step::4 Insert the code given below

<html>
<head>
<style>
body, html{    
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;  
}
</style>
</head>
<body oncontextmenu="return false;">
Here is my code. Select me.
</body>
</html>

Step::5 Click on Save changes button and close the editor.

How to disable selection on your webpage

Test the file in a new tab from your web browser. You will find that your selection feature has been disabled. Infact you will not be able to select any line on your website not even by dragging and dropping.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here