to prevent right-click downloading
- jeronath
- Sr. Bludit
- Posts: 37
- Joined: Tue Apr 26, 2022 11:54 am
- Location: Paris
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Hello everybody,
I have a basic question but I don't find the answer by myself as I am not a php developer.
I would like to add <body oncontextmenu="return false"> in my web site to prevent right-click downloading. In which php file and where in it can I add this ?
Thanks in advance for your help.
I have a basic question but I don't find the answer by myself as I am not a php developer.
I would like to add <body oncontextmenu="return false"> in my web site to prevent right-click downloading. In which php file and where in it can I add this ?
Thanks in advance for your help.
JeroNath
https://laminutespirituelle.fr
https://laminutespirituelle.fr
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Sorry, this question is not related to Bludit, and it is a misunderstanding.
oncontextmenu is a Javascript event that needs a function:
https://www.w3schools.com/jsref/event_oncontextmenu.asp
For disabling right clicks search for "disable right click images" or something like this. There are a lot of instructions how it can be done.
But be aware that images always can be downloaded despite disabling right clicks.
This has nothing to do with right clicks to disable downloading images.I would like to add <body oncontextmenu="return false"> in my web site to prevent right-click downloading.
oncontextmenu is a Javascript event that needs a function:
https://www.w3schools.com/jsref/event_oncontextmenu.asp
For disabling right clicks search for "disable right click images" or something like this. There are a lot of instructions how it can be done.
But be aware that images always can be downloaded despite disabling right clicks.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- multicolordev
- Master Bludit
- Posts: 137
- Joined: Thu May 26, 2022 12:33 pm
- Has thanked: 15 times
- Been thanked: 91 times
- jeronath
- Sr. Bludit
- Posts: 37
- Joined: Tue Apr 26, 2022 11:54 am
- Location: Paris
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Hello multicolordev,multicolordev wrote: ↑Sun Jun 05, 2022 2:48 pm I can create plugin for disable right button on all website on only or image if you want:)
I would like to know how to make a plugin but I am not a developer. So if you can make one to avoid the right-click either on some photos or on the whole site that would be really nice!
I use for my website royalty free photos but also sometimes personal photos a little worked and I would like to avoid that they are easy to download. Even if I know that by looking at the code you can find the url...
Thanks in advance!
Best regards.
JeroNath
https://laminutespirituelle.fr
https://laminutespirituelle.fr
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
Why looking at the code? A screenshoot is enough.
Or you can use a browser addon like this one:
https://chrome.google.com/webstore/deta ... ck-for-go/
People know what to do!
If you do not want that something can be downloaded from your website, do not upload it.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- jeronath
- Sr. Bludit
- Posts: 37
- Joined: Tue Apr 26, 2022 11:54 am
- Location: Paris
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Ok Edi there are many ways to download an image from a web page and I know I can't totally prevent it unless I am a very advanced developer which I am not. You wrote this to me in your two posts and I knew it even before your indications.Edi wrote: ↑Sun Jun 05, 2022 7:02 pmWhy looking at the code? A screenshoot is enough.
Or you can use a browser addon like this one:
https://chrome.google.com/webstore/deta ... ck-for-go/
People know what to do!
If you do not want that something can be downloaded from your website, do not upload it.
However, not everyone knows these ways or will look for them and it may be enough to disable the right click to prevent a number of these downloads.
But as I don't quite understand how a Bludit page is generated and I can't find the information in the documentation I repeat my question: in which file should I add code to prevent right-click on my site?
I found some code here: https://www.oflox.com/blog/how-to-disab ... ite_In_PHP but I don't know where to add it.
Is it possible to have an answer to this question?
Thank you in advance for your help.
JeroNath
https://laminutespirituelle.fr
https://laminutespirituelle.fr
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
1) Open the file index.php of your theme, and add oncontextmenu="return false" to the tag <body>:
2) Enable the plugin HTML Code and add the following to the field "Head":
Code: Select all
<body oncontextmenu="return false">
Code: Select all
<script>
window.oncontextmenu = function () {
return false;
}
$(document).keydown(function (event) {
if (event.keyCode == 123) {
return false;
}
else if ((event.ctrlKey && event.shiftKey && event.keyCode == 73) || (event.ctrlKey && event.shiftKey && event.keyCode == 74)) {
return false;
}
});
</script>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- jeronath
- Sr. Bludit
- Posts: 37
- Joined: Tue Apr 26, 2022 11:54 am
- Location: Paris
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Hello Edi,Edi wrote: ↑Mon Jun 06, 2022 4:43 pm 1) Open the file index.php of your theme, and add oncontextmenu="return false" to the tag <body>:
2) Enable the plugin HTML Code and add the following to the field "Head":Code: Select all
<body oncontextmenu="return false">
Code: Select all
<script> window.oncontextmenu = function () { return false; } $(document).keydown(function (event) { if (event.keyCode == 123) { return false; } else if ((event.ctrlKey && event.shiftKey && event.keyCode == 73) || (event.ctrlKey && event.shiftKey && event.keyCode == 74)) { return false; } }); </script>
Thanks a lot for your help !
That works perfectly !
JeroNath
https://laminutespirituelle.fr
https://laminutespirituelle.fr