Javascript script disable text selection method

By . Category: javascript, Web Tags: , ,

irnanto.comText selection or selection of text is a thing that often we do on a text content to select the text to be processed further like to copy. Currently looking for information has been very easy, especially looking for information on search engines that display certain web sites according to the key words we are looking for or what we want. User can copy the article that appeared on the search results they do with how to select text content.

After selecting the text that will be copied, the user will use the shortcut Ctrl + C or right click and select copy to copy the text that has been selected. To prevent that from happening, we must create safeguards to prevent acts of plagiarism of our web content. It is very easy to disable text selection by using a javascript text selection.

disable text selection web

disable text selection web

Javascript script selection is that we will create a very simple, because you can put this script to disable text selection in the tag body or head section.

How to install the script javascript disable text selection

You simply type in the following script tag in the head or body tag on your website.

<script type=”text/javascript”>
    function disabletext(e){
        return false;
    }
    function reEnable(){
        return true;
    }
    //if the browser is IE4+
    document.onselectstart=new Function (“return false”);
    //if the browser is NS6
    if (window.sidebar){
        document.onmousedown=disabletext;
        document.onclick=reEnable;
    }
</script>

If so, please save the script to disable the selection of text that you type on your web files. Please try the results of the changes you make. Berhasilkan? But you must secure over your content in a way to disable right click and disable the shortcut Ctrl + C.

Ok, here first discussion on how to disable text javascript script selection. May be useful.

Ads

No comments yet untuk “Javascript script disable text selection method”

Tinggalkan Komentar