How to prevent downloading images and video files from my website? Is it possible? What would be the best way to do this?
相关问题
- Views base64 encoded blob in HTML with PHP
- How to get the background from multiple images by
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
No it's not. You may block right-clicks and simillar stuff but if someone wants to download it, he will do so, trust me ;)
I think the best way is: STREAM THE VIDEO IN SEPARATED ENCRYPTED PARTS.
There are video hosting services such as vzaar that have this functionality. As far as I know, that will make it really hard to download directly. At least for 95% of the people.
But of course, if the video plays on the screen people can just use a screen recorder and some simple software to record sound from the audio output (but he/she will have to play the ENTIRE thing to save it, totally inconvenient).
This is how I do it in case anyone in the future is wondering.
I put this in the .htaccess file on the root server:
This stops them from say going to domain.com/videos/myVid.mp4 and then saving it from there.
I think the best way is to prevent right clicking on your webpage, because that is the most convenient way a normal user try to download the content, and you can consider it as remark if u able to do this only as you are never gonna be able to stop a computer geek or hacker people from downloading it, because once the content is on the internet, it means it is in the public domain already...
If you are using PHP, the best way is to control it the
.htaccess
, you need to put your files, images and videos under consideration in a separate folder/directory, and create a new.htaccess
file in this directory with the below:The first line
%{REQUEST_URI}
will prevent getting the file through the web browser, or throughcurl
. The second line%{HTTP_REFERER}
will prevent accessing the imahe/video using HTML tags<img>
or<video>
from any website except the exception!
you provide instead ofhttp://sample.com/
which usually should be your website itself.You can also have a look at my question and the accepted answer here for more tricks in the browser side.
As soon as they view your page that includes the picture or video, the item is downloaded into the temporary folder of their browser. So if you don't want it downloaded, don't post it.