How to use the enque script function to disable right click on a wordpress site

30 Views Asked by At

enter image description here

Is there any way I can make this script load first or have my content protection plugins load first? Maybe even excempt certain plugins from being altered by seraphinite accelerator? The enque function is what a lot of places are telling me to use to load a script first but I don't really know how to code or use it.

I am using the seraphinite accelerator plugin since it has seemed to speed up the load time of my pages but I think it has changed the way my scripts load to make it faster which is fine but the plugins I used to help with content protection, like disabling right click are now delayed and activate a few seconds late when first loading a page. These plugins used to be active as soon as the page loaded to disable right click.

The image I attached is the code I found on youtube that is supposed to disable right click on my website manually. The video told me to put this at the end of the footer.php file between "body" and "html" (For the astra theme). But I still have the delay before right click is stopped by my plugins. When I checked the source of my page, the script I put into the footer loaded at the very end it seems like.

2

There are 2 best solutions below

0
hasan darwish On

So, if I am right, you need to load a specific script first, if it is a javascript code, then you need to write in the html :

<script src="myFirstScript.js"></script>
<script src="mySecondScript.js"></script>
<script src="myThirdScript.js"></script>

and if it is a PHP , then put the PHP code first :

echo("My first line executed !") ;
echo("My second line executed !") ;
0
matin saber On

you can also use a CSS like this in your site :

body {
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
    -khtml-user-select: none; /* Konqueror HTML */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
    user-select: none; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
}