Prevent HTML5 video from being downloaded (right-click saved)?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







142















How can I disable "Save Video As..." from a browser's right-click menu to prevent clients from downloading a video?



Are there more complete solutions that prevent the client from accessing a file path directly?










share|improve this question




















  • 3





    I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

    – user166390
    Mar 18 '12 at 8:35








  • 3





    Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

    – Synetech
    Jul 25 '15 at 0:43











  • I like TxRegex answer the best as a quick basic solution.

    – jsherk
    Dec 4 '17 at 2:04











  • I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

    – Johan Boulé
    Jul 13 '18 at 14:11


















142















How can I disable "Save Video As..." from a browser's right-click menu to prevent clients from downloading a video?



Are there more complete solutions that prevent the client from accessing a file path directly?










share|improve this question




















  • 3





    I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

    – user166390
    Mar 18 '12 at 8:35








  • 3





    Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

    – Synetech
    Jul 25 '15 at 0:43











  • I like TxRegex answer the best as a quick basic solution.

    – jsherk
    Dec 4 '17 at 2:04











  • I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

    – Johan Boulé
    Jul 13 '18 at 14:11














142












142








142


107






How can I disable "Save Video As..." from a browser's right-click menu to prevent clients from downloading a video?



Are there more complete solutions that prevent the client from accessing a file path directly?










share|improve this question
















How can I disable "Save Video As..." from a browser's right-click menu to prevent clients from downloading a video?



Are there more complete solutions that prevent the client from accessing a file path directly?







javascript html5 menu html5-video right-click






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 7 '17 at 3:35









Mureinik

188k22142207




188k22142207










asked Mar 18 '12 at 7:53









pythonpython

9333913




9333913








  • 3





    I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

    – user166390
    Mar 18 '12 at 8:35








  • 3





    Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

    – Synetech
    Jul 25 '15 at 0:43











  • I like TxRegex answer the best as a quick basic solution.

    – jsherk
    Dec 4 '17 at 2:04











  • I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

    – Johan Boulé
    Jul 13 '18 at 14:11














  • 3





    I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

    – user166390
    Mar 18 '12 at 8:35








  • 3





    Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

    – Synetech
    Jul 25 '15 at 0:43











  • I like TxRegex answer the best as a quick basic solution.

    – jsherk
    Dec 4 '17 at 2:04











  • I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

    – Johan Boulé
    Jul 13 '18 at 14:11








3




3





I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

– user166390
Mar 18 '12 at 8:35







I up-voted this question because it only absolutely asks for how to "disable the right-click" for an HTML5 video. I am not sure if it is similar to right-click disabling for normal images or if there are other overlay tricks, etc., that can be applied.

– user166390
Mar 18 '12 at 8:35






3




3





Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

– Synetech
Jul 25 '15 at 0:43





Even if you disable right-click, they can still save it from the browser menu (File→Save As). Even if you could somehow block that, they can view-source to find the URL of the file. Even if you could obscure that a bit, they can rip it from the cache. Even if you could complicate that (e.g., stream), they can capture the network traffic with a sniffer or something. The fact is, if you send it to a user, they can save it. No way around that. The question you need to ask is why you need to stop it so badly. Is it really even that necessary? Is it worth the effort and user-unfriendly–ness?

– Synetech
Jul 25 '15 at 0:43













I like TxRegex answer the best as a quick basic solution.

– jsherk
Dec 4 '17 at 2:04





I like TxRegex answer the best as a quick basic solution.

– jsherk
Dec 4 '17 at 2:04













I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

– Johan Boulé
Jul 13 '18 at 14:11





I'm going to look pedantic here, but you're overloading the term "download". You of course do want to allow the video to be downloaded.

– Johan Boulé
Jul 13 '18 at 14:11












18 Answers
18






active

oldest

votes


















193














You can't. That's because that's what browsers were designed to do: Serve content. But you can make it harder to download.



First thing's first, you could disable the contextmenu event, aka "the right click". That would prevent your regular skiddie from blatantly ripping your video by right clicking and Save As. But then they could just disable JS and get around this or find the video source via the browser's debugger. Plus this is bad UX. There are lots of legitimate things in a context menu than just Save As.



You could also use custom video player libraries. Most of them implement video players that customize the context menu to your liking. So you don't get the default browser context menu. And if ever they do serve a menu item similar to Save As, you can disable it. But again, this is a JS workaround. Weaknesses are similar to the previous option.



Another way to do it is to serve the video using HTTP Live Streaming. What it essentially does is chop up the video into chunks and serve it one after the other. This is how most streaming sites serve video. So even if you manage to Save As, you only save a chunk, not the whole video. It would take a bit more effort to gather all the chunks and stitch them using some dedicated software.



Another technique is to paint <video> on <canvas>. In this technique, with a bit of JavaScript, what you see on the page is a <canvas> element rendering frames from a hidden <video>. And because it's a <canvas>, the context menu will use an <img>'s menu, not a <video>'s. You'll get a Save Image As instead of a Save Video As.



You could also use CSRF tokens to your advantage. You'd have your sever send down a token on the page. You then use that token to fetch your video. Your server checks to see if it's a valid token before it serves the video, or get an HTTP 401. The idea is that you can only ever get a video by having a token which you can only ever get if you came from the page, not directly visiting the video url.



At the end of the day, I'd just upload my video to a third-party video site, like YouTube or Vimeo. They have good video management tools, optimizes playback to the device, and they make efforts in preventing their videos from being ripped with zero effort on your end.






share|improve this answer





















  • 1





    thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

    – python
    Mar 18 '12 at 8:43






  • 2





    that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

    – Joseph
    Mar 18 '12 at 8:49








  • 1





    well, i found an article talking about overlaying the video tag with a div. updated my answer

    – Joseph
    Mar 18 '12 at 9:25








  • 2





    Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

    – Trung
    Jun 19 '13 at 4:26






  • 1





    @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

    – Joseph
    Sep 4 '14 at 2:27





















108














This is a simple solution for those wishing to simply remove the right-click "save" option from the html5 videos



$(document).ready(function(){
$('#videoElementID').bind('contextmenu',function() { return false; });
});





share|improve this answer
























  • That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

    – CoachNono
    Jun 7 '13 at 20:46






  • 2





    This does not help however if JavaScript is disabled in the browser.

    – mvark
    May 2 '14 at 16:10






  • 2





    Thanks, this solution is sufficent for 90 % of all our visitors.

    – Kai Noack
    Jun 5 '14 at 6:12






  • 2





    Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

    – SexyBeast
    Sep 3 '14 at 11:31






  • 10





    I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

    – Unapedra
    Sep 5 '14 at 10:30



















33














Simple answer,



YOU CAN'T



If they are watching your video, they have it already




You can slow them down but can't stop them.







share|improve this answer


























  • By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

    – Gustavo Rodrigues
    Aug 24 '15 at 22:06











  • And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

    – dlopezgonzalez
    Nov 17 '16 at 16:33








  • 2





    That is not an answer to either of the questions.

    – Tzshand
    Dec 29 '16 at 3:14











  • However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

    – Scott Chu
    May 2 '18 at 4:10











  • @ScottChu, Well, maybe but still you can't prevent it.

    – Starx
    May 2 '18 at 8:30



















22














The best way that I usually use is very simple, I fully disable context menu in the whole page, pure html+javascript:



 <body oncontextmenu="return false;">


That's it! I do that because you can always see the source by right click.

Ok, you say: "I can use directly the browser view source" and it's true but we start from the fact that you CAN'T stop downloading html5 videos.






share|improve this answer


























  • I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

    – John Balvin Arias
    Jun 7 '18 at 4:17



















21














Yes, you can do this in three steps:






  1. Place the files you want to protect in a subdirectory of the directory where your code is running.


    www.foo.com/player.html
    www.foo.com/videos/video.mp4





  2. Save a file in that subdirectory named ".htaccess" and add the lines below.




    www.foo.com/videos/.htaccess




    #Contents of .htaccess

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://foo.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.foo.com/.*$ [NC]
    RewriteRule .(mp4|mp3|avi)$ - [F]



Now the source link is useless, but we still need to make sure any user attempting to download the file cannot be directly served the file.





  1. For a more complete solution, now serve the video with a flash player (or html canvas) and never link to the video directly. To just remove the right click menu, add to your HTML:



    <body oncontextmenu="return false;">






The Result:



www.foo.com/player.html will correctly play video, but if you visit www.foo.com/videos/video.mp4:




Error Code 403: FORBIDDEN







This will work for direct download, cURL, hotlinking, you name it.



This is a complete answer to the two questions asked and not an answer to the question: "can I stop a user from downloading a video they have already downloaded."






share|improve this answer





















  • 1





    Great answer, but you have a ` that you should remove it from your .htaccess content

    – MAZux
    Jul 6 '17 at 8:22








  • 1





    You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

    – Shiroy
    Sep 1 '17 at 18:34











  • It seems still IDM can download it!

    – PersianMan
    Jun 24 '18 at 5:42











  • @PersianMan Correct - I encourage you to read the first answers

    – Tzshand
    Jun 28 '18 at 1:59






  • 1





    Only works on Apache servers. No NGINX or IIS

    – Nick
    Jul 1 '18 at 15:22



















12














As a client-side developer I recommend to use blob URL,
blob URL is a client-side URL which refers to a binary object



<video id="id" width="320" height="240"  type='video/mp4' controls  > </video>


in HTML leave your video src blank,
and in JS fetch the video file using AJAX, make sure the response type is blob



window.onload = function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'mov_bbb.mp4', true);
xhr.responseType = 'blob'; //important
xhr.onload = function(e) {
if (this.status == 200) {
console.log("loaded");
var blob = this.response;
var video = document.getElementById('id');
video.oncanplaythrough = function() {
console.log("Can play through video without stopping");
URL.revokeObjectURL(this.src);
};
video.src = URL.createObjectURL(blob);
video.load();
}
};
xhr.send();
}


Note: This method is not recommended for large file



EDIT




  • Use cross-origin blocking for avoiding direct downloading


  • if the video is delivered by an API Use different method (PUT/POST) instead of 'GET'







share|improve this answer





















  • 3





    YouTube uses Blob now too i think :) ?

    – C0nw0nk
    Jul 20 '17 at 22:13






  • 1





    Can you explain what's going on here more clearly and how to set up the server for this?

    – Antoine
    Dec 1 '17 at 1:21











  • When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

    – Coderer
    Apr 17 '18 at 10:03













  • But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

    – Gleb Dolzikov
    May 2 '18 at 12:59






  • 1





    @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

    – NerdOfCode
    Jun 7 '18 at 4:48



















10














PHP sends the html5 video tag together with a session where the key is a random string and the value is the filename.



ini_set('session.use_cookies',1);
session_start();
$ogv=uniqid();
$_SESSION[$ogv]='myVideo.ogv';
$webm=uniqid();
$_SESSION[$webm]='myVideo.webm';
echo '<video autoplay="autoplay">'
.'<source src="video.php?video='.$ogv.' type="video/ogg">'
.'<source src="video.php?video='.$webm.' type="video/webm">'
.'</video>';


Now PHP is asked to send the video. PHP recovers the filename; deletes the session and sends the video instantly. Additionally all the 'no cache' and mime-type headers must be present.



ini_set('session.use_cookies',1);
session_start();
$file='myhiddenvideos/'.$_SESSION[$_GET['video']];
$_SESSION=array();
$params = session_get_cookie_params();
setcookie(session_name(),'', time()-42000,$params["path"],$params["domain"],
$params["secure"], $params["httponly"]);
if(!file_exists($file) or $file==='' or !is_readable($file)){
header('HTTP/1.1 404 File not found',true);
exit;
}
readfile($file);
exit:


Now if the user copy the url in a new tab or use the context menu he will have no luck.






share|improve this answer


























  • I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

    – user1252280
    Dec 21 '17 at 20:48



















5














You can at least stop the the non-tech savvy people from using the right-click context menu to download your video. You can disable the context menu for any element using the oncontextmenu attribute.



oncontextmenu="return false;"


This works for the body element (whole page) or just a single video using it inside the video tag.



<video oncontextmenu="return false;" controls>...</video>





share|improve this answer

































    3














    +1 simple and cross-browser way:
    You can also put transparent picture over the video with css z-index and opacity.
    So users will see "save picture as" instead of "save video" in context menu.






    share|improve this answer



















    • 1





      why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

      – Waqas Tahir
      Dec 31 '15 at 5:57











    • I am not sure but still video can be downloaded via File>SaveAs

      – Arun Kumar
      Aug 10 '16 at 11:13



















    3














    We ended up using AWS CloudFront with expiring URLs. The video will load, but by the time the user right clicks and chooses Save As the video url they initially received has expired. Do a search for CloudFront Origin Access Identity.



    Producing the video url requires a key pair which can be created in the AWS CLI. FYI this is not my code but it works great!



    $resource = 'http://cdn.yourwebsite.com/videos/yourvideourl.mp4';
    $timeout = 4;

    //This comes from key pair you generated for cloudfront
    $keyPairId = "AKAJSDHFKASWERASDF";

    $expires = time() + $timeout; //Time out in seconds
    $json = '{"Statement":[{"Resource":"'.$resource.'","Condition" {"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';

    //Read Cloudfront Private Key Pair
    $fp=fopen("/absolute/path/to/your/cloudfront_privatekey.pem","r");
    $priv_key=fread($fp,8192);
    fclose($fp);

    //Create the private key
    $key = openssl_get_privatekey($priv_key);
    if(!$key)
    {
    echo "<p>Failed to load private key!</p>";
    return;
    }

    //Sign the policy with the private key
    if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1))
    {
    echo '<p>Failed to sign policy: '.openssl_error_string().'</p>';
    return;
    }

    //Create url safe signed policy
    $base64_signed_policy = base64_encode($signed_policy);
    $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy);

    //Construct the URL
    $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId;

    return '<div class="videowrapper" ><video autoplay controls style="width:100%!important;height:auto!important;"><source src="'.$url.'" type="video/mp4">Your browser does not support the video tag.</video></div>';





    share|improve this answer
























    • Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

      – Zmart
      Oct 18 '18 at 3:29











    • If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

      – Chud37
      Apr 5 at 12:27



















    2














    Using a service such as Vimeo: Sign in Vimeo > Goto Video > Settings > Privacy > Mark as Secured, and also select embed domains. Once the embed domains are set, it will not allow anyone to embed the video or display it from the browser unless connecting from the domains specified. So, if you have a page that is secured on your server which loads the Vimeo player in iframe, this makes it pretty difficult to get around.






    share|improve this answer

































      2














      First of all realise it is impossible to completely prevent a video being downloaded, all you can do is make it more difficult. I.e. you hide the source of the video.



      A web browser temporarily downloads the video in a buffer, so if could prevent download you would also be preventing the video being viewed as well.



      You should also know that <1% of the total population of the world will be able to understand the source code making it rather safe anyway. That does not mean you should not hide it in the source as well - you should.



      You should not disable right click, and even less you should display a message saying "You cannot save this video for copyright reasons. Sorry about that.". As suggested in this answer.



      This can be very annoying and confusing for the user. Apart from that; if they disable JavaScript on their browser they will be able to right click and save anyway.



      Here is a CSS trick you could use:



      video {
      pointer-events: none;
      }


      CSS cannot be turned off in browser, protecting your video without actually disabling right click. However one problem is that controls cannot be enabled either, in other words they must be set to false. If you are going to inplament your own Play/Pause function or use an API that has buttons separate to the video tag then this is a feasible option.



      controls also has a download button so using it is not such a good idea either.



      Here is a JSFiddle example.





      If you are going to disable right click using JavaScript then also store the source of the video in JavaScript as well. That way if the user disables JavaScript (allowing right click) the video will not load (it also hides the video source a little better).



      From TxRegex answer:



      <video oncontextmenu="return false;" controls>
      <source type="video/mp4" id="video">
      </video>


      Now add the video via JavaScript:



      document.getElementById("video").src = "https://www.w3schools.com/html/mov_bbb.mp4";


      Functional JSFiddle





      Another way to prevent right click involves using the embed tag. This is does not however provide the controls to run the video so they would need to be inplamented in JavaScript:



      <embed src="https://www.w3schools.com/html/mov_bbb.mp4"></embed>





      share|improve this answer



















      • 1





        Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

        – Simone
        Feb 26 at 8:14











      • @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

        – Simon
        Feb 26 at 11:37





















      2














      The



      <body oncontextmenu="return false;"> 


      no longer works. Chrome and Opera as of June 2018 has a submenu on the timeline to allow straight download, so user doesn't need to right click to download that video. Interestingly Firefox and Edge don't have this ...






      share|improve this answer































        1














        Short Answer: Encrypt the link like youtube does, don't know how than ask youtube/google of how they do it. (Just in case you want to get straight into the point.)



        I would like to point out to anyone that this is possible because youtube does it and if they can so can any other website and it isn't from the browser either because I tested it on a couple browsers such as microsoft edge and internet explorer and so there is a way to disable it and seen that people still say it...I tries looking for an answer because if youtube can than there has to be a way and the only way to see how they do it is if someone looked into the scripts of youtube which I am doing now. I also checked to see if it was a custom context menu as well and it isn't because the context menu is over flowing the inspect element and I mean like it is over it and I looked and it never creates a new class and also it is impossible to actually access inspect element with javascript so it can't be. You can tell when it double right-click a youtube video that it pops up the context menu for chrome. Besides...youtube wouldn't add that function in. I am doing research and looking through the source of youtube so I will be back if I find the answer...if anyone says you can't than, well they didn't do research like I have. The only way to download youtube videos is through a video download.



        Okay...I did research and my research stays that you can disable it except there is no javascript to it...you have to be able to encrypt the links to the video for you to be able to disable it because I think any browser won't show it if it can't find it and when I opened a youtube video link it showed as this "blob:https://www.youtube.com/e5c4808e-297e-451f-80da-3e838caa1275" without quotes so it is encrypting it so it cannot be saved...you need to know php for that but like the answer you picked out of making it harder, youtube makes it the hardest of heavy encrypting it, you need to be an advance php programmer but if you don't know that than take the person you picked as best answer of making it hard to download it...but if you know php than heavy encrypt the video link so it only is able to be read on yours...I don't know how to explain how they do it but they did and there is a way. The way youtube Encrypts there videos is quite smart so if you want to know how to than just ask youtube/google of how they do it...hope this helps for you although you already picked a best answer. So encrypting the link is best in short terms.






        share|improve this answer

































          0














          It seems like streaming the video through websocket is a viable option, as in stream the frames and draw them on a canvas sort of thing.



          Video streaming over websockets using JavaScript



          I think that would provide another level of protection making it more difficult for the client to acquire the video and of course solve your problem with "Save video as..." right-click context menu option ( overkill ?! ).






          share|improve this answer

































            0














            Here's what I did:






            function noRightClick() {
            alert("You cannot save this video for copyright reasons. Sorry about that.");
            }

                <body oncontextmenu="noRightClick();">
            <video>
            <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
            </video>
            </body>




            This also works for images, text and pretty much anything. However, you can still access the "Inspect" and the "View source" tool through keyboard shortcuts. (As the answer at the top says, you can't stop it entirely.) But you can try to put barriers up to stop them.




            share|improve this answer































              0














              We could make that not so easy by hiding context menu, like this:



              <video oncontextmenu="return false;"  controls>
              <source src="https://yoursite.com/yourvideo.mp4" >
              </video>





              share|improve this answer































                -1














                @Clayton-Graul had what I was looking for, except I needed the CoffeeScript version for a site using AngularJS. Just in case you need that too, here's what you put in the AngularJS controller in question:



                    # This is how to we do JQuery ready() dom stuff
                $ ->
                # let's hide those annoying download video options.
                # of course anyone who knows how can still download
                # the video, but hey... more power to 'em.
                $('#my-video').bind 'contextmenu', ->
                false


                "strange things are afoot at the circle k" (it's true)






                share|improve this answer






















                  protected by Tushar Gupta - curioustushar Oct 4 '14 at 6:54



                  Thank you for your interest in this question.
                  Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                  Would you like to answer one of these unanswered questions instead?














                  18 Answers
                  18






                  active

                  oldest

                  votes








                  18 Answers
                  18






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  193














                  You can't. That's because that's what browsers were designed to do: Serve content. But you can make it harder to download.



                  First thing's first, you could disable the contextmenu event, aka "the right click". That would prevent your regular skiddie from blatantly ripping your video by right clicking and Save As. But then they could just disable JS and get around this or find the video source via the browser's debugger. Plus this is bad UX. There are lots of legitimate things in a context menu than just Save As.



                  You could also use custom video player libraries. Most of them implement video players that customize the context menu to your liking. So you don't get the default browser context menu. And if ever they do serve a menu item similar to Save As, you can disable it. But again, this is a JS workaround. Weaknesses are similar to the previous option.



                  Another way to do it is to serve the video using HTTP Live Streaming. What it essentially does is chop up the video into chunks and serve it one after the other. This is how most streaming sites serve video. So even if you manage to Save As, you only save a chunk, not the whole video. It would take a bit more effort to gather all the chunks and stitch them using some dedicated software.



                  Another technique is to paint <video> on <canvas>. In this technique, with a bit of JavaScript, what you see on the page is a <canvas> element rendering frames from a hidden <video>. And because it's a <canvas>, the context menu will use an <img>'s menu, not a <video>'s. You'll get a Save Image As instead of a Save Video As.



                  You could also use CSRF tokens to your advantage. You'd have your sever send down a token on the page. You then use that token to fetch your video. Your server checks to see if it's a valid token before it serves the video, or get an HTTP 401. The idea is that you can only ever get a video by having a token which you can only ever get if you came from the page, not directly visiting the video url.



                  At the end of the day, I'd just upload my video to a third-party video site, like YouTube or Vimeo. They have good video management tools, optimizes playback to the device, and they make efforts in preventing their videos from being ripped with zero effort on your end.






                  share|improve this answer





















                  • 1





                    thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                    – python
                    Mar 18 '12 at 8:43






                  • 2





                    that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                    – Joseph
                    Mar 18 '12 at 8:49








                  • 1





                    well, i found an article talking about overlaying the video tag with a div. updated my answer

                    – Joseph
                    Mar 18 '12 at 9:25








                  • 2





                    Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                    – Trung
                    Jun 19 '13 at 4:26






                  • 1





                    @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                    – Joseph
                    Sep 4 '14 at 2:27


















                  193














                  You can't. That's because that's what browsers were designed to do: Serve content. But you can make it harder to download.



                  First thing's first, you could disable the contextmenu event, aka "the right click". That would prevent your regular skiddie from blatantly ripping your video by right clicking and Save As. But then they could just disable JS and get around this or find the video source via the browser's debugger. Plus this is bad UX. There are lots of legitimate things in a context menu than just Save As.



                  You could also use custom video player libraries. Most of them implement video players that customize the context menu to your liking. So you don't get the default browser context menu. And if ever they do serve a menu item similar to Save As, you can disable it. But again, this is a JS workaround. Weaknesses are similar to the previous option.



                  Another way to do it is to serve the video using HTTP Live Streaming. What it essentially does is chop up the video into chunks and serve it one after the other. This is how most streaming sites serve video. So even if you manage to Save As, you only save a chunk, not the whole video. It would take a bit more effort to gather all the chunks and stitch them using some dedicated software.



                  Another technique is to paint <video> on <canvas>. In this technique, with a bit of JavaScript, what you see on the page is a <canvas> element rendering frames from a hidden <video>. And because it's a <canvas>, the context menu will use an <img>'s menu, not a <video>'s. You'll get a Save Image As instead of a Save Video As.



                  You could also use CSRF tokens to your advantage. You'd have your sever send down a token on the page. You then use that token to fetch your video. Your server checks to see if it's a valid token before it serves the video, or get an HTTP 401. The idea is that you can only ever get a video by having a token which you can only ever get if you came from the page, not directly visiting the video url.



                  At the end of the day, I'd just upload my video to a third-party video site, like YouTube or Vimeo. They have good video management tools, optimizes playback to the device, and they make efforts in preventing their videos from being ripped with zero effort on your end.






                  share|improve this answer





















                  • 1





                    thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                    – python
                    Mar 18 '12 at 8:43






                  • 2





                    that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                    – Joseph
                    Mar 18 '12 at 8:49








                  • 1





                    well, i found an article talking about overlaying the video tag with a div. updated my answer

                    – Joseph
                    Mar 18 '12 at 9:25








                  • 2





                    Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                    – Trung
                    Jun 19 '13 at 4:26






                  • 1





                    @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                    – Joseph
                    Sep 4 '14 at 2:27
















                  193












                  193








                  193







                  You can't. That's because that's what browsers were designed to do: Serve content. But you can make it harder to download.



                  First thing's first, you could disable the contextmenu event, aka "the right click". That would prevent your regular skiddie from blatantly ripping your video by right clicking and Save As. But then they could just disable JS and get around this or find the video source via the browser's debugger. Plus this is bad UX. There are lots of legitimate things in a context menu than just Save As.



                  You could also use custom video player libraries. Most of them implement video players that customize the context menu to your liking. So you don't get the default browser context menu. And if ever they do serve a menu item similar to Save As, you can disable it. But again, this is a JS workaround. Weaknesses are similar to the previous option.



                  Another way to do it is to serve the video using HTTP Live Streaming. What it essentially does is chop up the video into chunks and serve it one after the other. This is how most streaming sites serve video. So even if you manage to Save As, you only save a chunk, not the whole video. It would take a bit more effort to gather all the chunks and stitch them using some dedicated software.



                  Another technique is to paint <video> on <canvas>. In this technique, with a bit of JavaScript, what you see on the page is a <canvas> element rendering frames from a hidden <video>. And because it's a <canvas>, the context menu will use an <img>'s menu, not a <video>'s. You'll get a Save Image As instead of a Save Video As.



                  You could also use CSRF tokens to your advantage. You'd have your sever send down a token on the page. You then use that token to fetch your video. Your server checks to see if it's a valid token before it serves the video, or get an HTTP 401. The idea is that you can only ever get a video by having a token which you can only ever get if you came from the page, not directly visiting the video url.



                  At the end of the day, I'd just upload my video to a third-party video site, like YouTube or Vimeo. They have good video management tools, optimizes playback to the device, and they make efforts in preventing their videos from being ripped with zero effort on your end.






                  share|improve this answer















                  You can't. That's because that's what browsers were designed to do: Serve content. But you can make it harder to download.



                  First thing's first, you could disable the contextmenu event, aka "the right click". That would prevent your regular skiddie from blatantly ripping your video by right clicking and Save As. But then they could just disable JS and get around this or find the video source via the browser's debugger. Plus this is bad UX. There are lots of legitimate things in a context menu than just Save As.



                  You could also use custom video player libraries. Most of them implement video players that customize the context menu to your liking. So you don't get the default browser context menu. And if ever they do serve a menu item similar to Save As, you can disable it. But again, this is a JS workaround. Weaknesses are similar to the previous option.



                  Another way to do it is to serve the video using HTTP Live Streaming. What it essentially does is chop up the video into chunks and serve it one after the other. This is how most streaming sites serve video. So even if you manage to Save As, you only save a chunk, not the whole video. It would take a bit more effort to gather all the chunks and stitch them using some dedicated software.



                  Another technique is to paint <video> on <canvas>. In this technique, with a bit of JavaScript, what you see on the page is a <canvas> element rendering frames from a hidden <video>. And because it's a <canvas>, the context menu will use an <img>'s menu, not a <video>'s. You'll get a Save Image As instead of a Save Video As.



                  You could also use CSRF tokens to your advantage. You'd have your sever send down a token on the page. You then use that token to fetch your video. Your server checks to see if it's a valid token before it serves the video, or get an HTTP 401. The idea is that you can only ever get a video by having a token which you can only ever get if you came from the page, not directly visiting the video url.



                  At the end of the day, I'd just upload my video to a third-party video site, like YouTube or Vimeo. They have good video management tools, optimizes playback to the device, and they make efforts in preventing their videos from being ripped with zero effort on your end.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 25 at 3:16

























                  answered Mar 18 '12 at 8:05









                  JosephJoseph

                  88.1k24147191




                  88.1k24147191








                  • 1





                    thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                    – python
                    Mar 18 '12 at 8:43






                  • 2





                    that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                    – Joseph
                    Mar 18 '12 at 8:49








                  • 1





                    well, i found an article talking about overlaying the video tag with a div. updated my answer

                    – Joseph
                    Mar 18 '12 at 9:25








                  • 2





                    Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                    – Trung
                    Jun 19 '13 at 4:26






                  • 1





                    @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                    – Joseph
                    Sep 4 '14 at 2:27
















                  • 1





                    thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                    – python
                    Mar 18 '12 at 8:43






                  • 2





                    that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                    – Joseph
                    Mar 18 '12 at 8:49








                  • 1





                    well, i found an article talking about overlaying the video tag with a div. updated my answer

                    – Joseph
                    Mar 18 '12 at 9:25








                  • 2





                    Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                    – Trung
                    Jun 19 '13 at 4:26






                  • 1





                    @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                    – Joseph
                    Sep 4 '14 at 2:27










                  1




                  1





                  thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                  – python
                  Mar 18 '12 at 8:43





                  thank you for the detail answer, is it possible at least disable the save as option from the right click menu? it will cover most basic knowledge cases

                  – python
                  Mar 18 '12 at 8:43




                  2




                  2





                  that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                  – Joseph
                  Mar 18 '12 at 8:49







                  that depends on the browser. i have seen times (especially firefox and chrome) that if the video is fully loaded, when you hit "save" they just pick the video from the cache instead of re-downloading (the video is already downloaded in the cache, why download it again?), thus there is no second request. the method above is applicable only when the link is reused.

                  – Joseph
                  Mar 18 '12 at 8:49






                  1




                  1





                  well, i found an article talking about overlaying the video tag with a div. updated my answer

                  – Joseph
                  Mar 18 '12 at 9:25







                  well, i found an article talking about overlaying the video tag with a div. updated my answer

                  – Joseph
                  Mar 18 '12 at 9:25






                  2




                  2





                  Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                  – Trung
                  Jun 19 '13 at 4:26





                  Thanks. I Just read craftymind.com/factory/html5video/CanvasVideo.html. The idea is almost same as your answer.

                  – Trung
                  Jun 19 '13 at 4:26




                  1




                  1





                  @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                  – Joseph
                  Sep 4 '14 at 2:27







                  @Cupidvogel The "onetime use url" is a server endpoint which accepts a server generated token. The token is generated upon page generation, and saved to the db. It is also shipped with the page as src of the <video>. By the time your page has loaded, the db has the token, the page has the token. Once <video> starts to load (Accesses the endpoint), server checks if token is in the db, deletes it and streams the file. If the token isn't there as a result of second access, then don't stream the file.

                  – Joseph
                  Sep 4 '14 at 2:27















                  108














                  This is a simple solution for those wishing to simply remove the right-click "save" option from the html5 videos



                  $(document).ready(function(){
                  $('#videoElementID').bind('contextmenu',function() { return false; });
                  });





                  share|improve this answer
























                  • That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                    – CoachNono
                    Jun 7 '13 at 20:46






                  • 2





                    This does not help however if JavaScript is disabled in the browser.

                    – mvark
                    May 2 '14 at 16:10






                  • 2





                    Thanks, this solution is sufficent for 90 % of all our visitors.

                    – Kai Noack
                    Jun 5 '14 at 6:12






                  • 2





                    Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                    – SexyBeast
                    Sep 3 '14 at 11:31






                  • 10





                    I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                    – Unapedra
                    Sep 5 '14 at 10:30
















                  108














                  This is a simple solution for those wishing to simply remove the right-click "save" option from the html5 videos



                  $(document).ready(function(){
                  $('#videoElementID').bind('contextmenu',function() { return false; });
                  });





                  share|improve this answer
























                  • That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                    – CoachNono
                    Jun 7 '13 at 20:46






                  • 2





                    This does not help however if JavaScript is disabled in the browser.

                    – mvark
                    May 2 '14 at 16:10






                  • 2





                    Thanks, this solution is sufficent for 90 % of all our visitors.

                    – Kai Noack
                    Jun 5 '14 at 6:12






                  • 2





                    Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                    – SexyBeast
                    Sep 3 '14 at 11:31






                  • 10





                    I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                    – Unapedra
                    Sep 5 '14 at 10:30














                  108












                  108








                  108







                  This is a simple solution for those wishing to simply remove the right-click "save" option from the html5 videos



                  $(document).ready(function(){
                  $('#videoElementID').bind('contextmenu',function() { return false; });
                  });





                  share|improve this answer













                  This is a simple solution for those wishing to simply remove the right-click "save" option from the html5 videos



                  $(document).ready(function(){
                  $('#videoElementID').bind('contextmenu',function() { return false; });
                  });






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 6 '13 at 18:39









                  Clayton GraulClayton Graul

                  1,171187




                  1,171187













                  • That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                    – CoachNono
                    Jun 7 '13 at 20:46






                  • 2





                    This does not help however if JavaScript is disabled in the browser.

                    – mvark
                    May 2 '14 at 16:10






                  • 2





                    Thanks, this solution is sufficent for 90 % of all our visitors.

                    – Kai Noack
                    Jun 5 '14 at 6:12






                  • 2





                    Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                    – SexyBeast
                    Sep 3 '14 at 11:31






                  • 10





                    I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                    – Unapedra
                    Sep 5 '14 at 10:30



















                  • That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                    – CoachNono
                    Jun 7 '13 at 20:46






                  • 2





                    This does not help however if JavaScript is disabled in the browser.

                    – mvark
                    May 2 '14 at 16:10






                  • 2





                    Thanks, this solution is sufficent for 90 % of all our visitors.

                    – Kai Noack
                    Jun 5 '14 at 6:12






                  • 2





                    Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                    – SexyBeast
                    Sep 3 '14 at 11:31






                  • 10





                    I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                    – Unapedra
                    Sep 5 '14 at 10:30

















                  That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                  – CoachNono
                  Jun 7 '13 at 20:46





                  That is fantastic ! It does a great job from preventing ordinary people from downloading the video !

                  – CoachNono
                  Jun 7 '13 at 20:46




                  2




                  2





                  This does not help however if JavaScript is disabled in the browser.

                  – mvark
                  May 2 '14 at 16:10





                  This does not help however if JavaScript is disabled in the browser.

                  – mvark
                  May 2 '14 at 16:10




                  2




                  2





                  Thanks, this solution is sufficent for 90 % of all our visitors.

                  – Kai Noack
                  Jun 5 '14 at 6:12





                  Thanks, this solution is sufficent for 90 % of all our visitors.

                  – Kai Noack
                  Jun 5 '14 at 6:12




                  2




                  2





                  Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                  – SexyBeast
                  Sep 3 '14 at 11:31





                  Bleh. Just inspect the element in Firebug, see the src attribute, and open that in another tab or use wget to download it!

                  – SexyBeast
                  Sep 3 '14 at 11:31




                  10




                  10





                  I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                  – Unapedra
                  Sep 5 '14 at 10:30





                  I think the main aim of this is to avoid "normal" users to download the video. This is a good solution to solve this situation.

                  – Unapedra
                  Sep 5 '14 at 10:30











                  33














                  Simple answer,



                  YOU CAN'T



                  If they are watching your video, they have it already




                  You can slow them down but can't stop them.







                  share|improve this answer


























                  • By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                    – Gustavo Rodrigues
                    Aug 24 '15 at 22:06











                  • And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                    – dlopezgonzalez
                    Nov 17 '16 at 16:33








                  • 2





                    That is not an answer to either of the questions.

                    – Tzshand
                    Dec 29 '16 at 3:14











                  • However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                    – Scott Chu
                    May 2 '18 at 4:10











                  • @ScottChu, Well, maybe but still you can't prevent it.

                    – Starx
                    May 2 '18 at 8:30
















                  33














                  Simple answer,



                  YOU CAN'T



                  If they are watching your video, they have it already




                  You can slow them down but can't stop them.







                  share|improve this answer


























                  • By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                    – Gustavo Rodrigues
                    Aug 24 '15 at 22:06











                  • And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                    – dlopezgonzalez
                    Nov 17 '16 at 16:33








                  • 2





                    That is not an answer to either of the questions.

                    – Tzshand
                    Dec 29 '16 at 3:14











                  • However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                    – Scott Chu
                    May 2 '18 at 4:10











                  • @ScottChu, Well, maybe but still you can't prevent it.

                    – Starx
                    May 2 '18 at 8:30














                  33












                  33








                  33







                  Simple answer,



                  YOU CAN'T



                  If they are watching your video, they have it already




                  You can slow them down but can't stop them.







                  share|improve this answer















                  Simple answer,



                  YOU CAN'T



                  If they are watching your video, they have it already




                  You can slow them down but can't stop them.








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 12 '12 at 15:43









                  harriyott

                  8,71775795




                  8,71775795










                  answered Mar 18 '12 at 8:15









                  StarxStarx

                  59.6k35159241




                  59.6k35159241













                  • By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                    – Gustavo Rodrigues
                    Aug 24 '15 at 22:06











                  • And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                    – dlopezgonzalez
                    Nov 17 '16 at 16:33








                  • 2





                    That is not an answer to either of the questions.

                    – Tzshand
                    Dec 29 '16 at 3:14











                  • However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                    – Scott Chu
                    May 2 '18 at 4:10











                  • @ScottChu, Well, maybe but still you can't prevent it.

                    – Starx
                    May 2 '18 at 8:30



















                  • By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                    – Gustavo Rodrigues
                    Aug 24 '15 at 22:06











                  • And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                    – dlopezgonzalez
                    Nov 17 '16 at 16:33








                  • 2





                    That is not an answer to either of the questions.

                    – Tzshand
                    Dec 29 '16 at 3:14











                  • However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                    – Scott Chu
                    May 2 '18 at 4:10











                  • @ScottChu, Well, maybe but still you can't prevent it.

                    – Starx
                    May 2 '18 at 8:30

















                  By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                  – Gustavo Rodrigues
                  Aug 24 '15 at 22:06





                  By the way, this answer apply with HTML5 videos, flash videos, or any technology you can imagine in the future. It's simple: it's how it works.

                  – Gustavo Rodrigues
                  Aug 24 '15 at 22:06













                  And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                  – dlopezgonzalez
                  Nov 17 '16 at 16:33







                  And what about youtube?, on youtube you cannot discove the video file easily. I mean that ok, you are right, we can, but is easily to hide the mp4 source on youtube or similar video hosting than host a simple mp4 in our server and use the html5 player.

                  – dlopezgonzalez
                  Nov 17 '16 at 16:33






                  2




                  2





                  That is not an answer to either of the questions.

                  – Tzshand
                  Dec 29 '16 at 3:14





                  That is not an answer to either of the questions.

                  – Tzshand
                  Dec 29 '16 at 3:14













                  However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                  – Scott Chu
                  May 2 '18 at 4:10





                  However, the segmented streaming video way is practically efficient way for almost 99% of hackers who wanna downloading your video).

                  – Scott Chu
                  May 2 '18 at 4:10













                  @ScottChu, Well, maybe but still you can't prevent it.

                  – Starx
                  May 2 '18 at 8:30





                  @ScottChu, Well, maybe but still you can't prevent it.

                  – Starx
                  May 2 '18 at 8:30











                  22














                  The best way that I usually use is very simple, I fully disable context menu in the whole page, pure html+javascript:



                   <body oncontextmenu="return false;">


                  That's it! I do that because you can always see the source by right click.

                  Ok, you say: "I can use directly the browser view source" and it's true but we start from the fact that you CAN'T stop downloading html5 videos.






                  share|improve this answer


























                  • I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                    – John Balvin Arias
                    Jun 7 '18 at 4:17
















                  22














                  The best way that I usually use is very simple, I fully disable context menu in the whole page, pure html+javascript:



                   <body oncontextmenu="return false;">


                  That's it! I do that because you can always see the source by right click.

                  Ok, you say: "I can use directly the browser view source" and it's true but we start from the fact that you CAN'T stop downloading html5 videos.






                  share|improve this answer


























                  • I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                    – John Balvin Arias
                    Jun 7 '18 at 4:17














                  22












                  22








                  22







                  The best way that I usually use is very simple, I fully disable context menu in the whole page, pure html+javascript:



                   <body oncontextmenu="return false;">


                  That's it! I do that because you can always see the source by right click.

                  Ok, you say: "I can use directly the browser view source" and it's true but we start from the fact that you CAN'T stop downloading html5 videos.






                  share|improve this answer















                  The best way that I usually use is very simple, I fully disable context menu in the whole page, pure html+javascript:



                   <body oncontextmenu="return false;">


                  That's it! I do that because you can always see the source by right click.

                  Ok, you say: "I can use directly the browser view source" and it's true but we start from the fact that you CAN'T stop downloading html5 videos.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 15 '16 at 9:21









                  Christian Giupponi

                  4,82764487




                  4,82764487










                  answered Jul 17 '14 at 14:16









                  Daniele CannovaDaniele Cannova

                  24925




                  24925













                  • I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                    – John Balvin Arias
                    Jun 7 '18 at 4:17



















                  • I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                    – John Balvin Arias
                    Jun 7 '18 at 4:17

















                  I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                  – John Balvin Arias
                  Jun 7 '18 at 4:17





                  I think the solución must be one that does not disturb "normal" users, disable right click will prevent users to copy and paste some text, or search a word they are intersested in, for example un the title of the video,of course not all users will likely do that but It can be anoying for some of them

                  – John Balvin Arias
                  Jun 7 '18 at 4:17











                  21














                  Yes, you can do this in three steps:






                  1. Place the files you want to protect in a subdirectory of the directory where your code is running.


                    www.foo.com/player.html
                    www.foo.com/videos/video.mp4





                  2. Save a file in that subdirectory named ".htaccess" and add the lines below.




                    www.foo.com/videos/.htaccess




                    #Contents of .htaccess

                    RewriteEngine on
                    RewriteCond %{HTTP_REFERER} !^http://foo.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.foo.com/.*$ [NC]
                    RewriteRule .(mp4|mp3|avi)$ - [F]



                  Now the source link is useless, but we still need to make sure any user attempting to download the file cannot be directly served the file.





                  1. For a more complete solution, now serve the video with a flash player (or html canvas) and never link to the video directly. To just remove the right click menu, add to your HTML:



                    <body oncontextmenu="return false;">






                  The Result:



                  www.foo.com/player.html will correctly play video, but if you visit www.foo.com/videos/video.mp4:




                  Error Code 403: FORBIDDEN







                  This will work for direct download, cURL, hotlinking, you name it.



                  This is a complete answer to the two questions asked and not an answer to the question: "can I stop a user from downloading a video they have already downloaded."






                  share|improve this answer





















                  • 1





                    Great answer, but you have a ` that you should remove it from your .htaccess content

                    – MAZux
                    Jul 6 '17 at 8:22








                  • 1





                    You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                    – Shiroy
                    Sep 1 '17 at 18:34











                  • It seems still IDM can download it!

                    – PersianMan
                    Jun 24 '18 at 5:42











                  • @PersianMan Correct - I encourage you to read the first answers

                    – Tzshand
                    Jun 28 '18 at 1:59






                  • 1





                    Only works on Apache servers. No NGINX or IIS

                    – Nick
                    Jul 1 '18 at 15:22
















                  21














                  Yes, you can do this in three steps:






                  1. Place the files you want to protect in a subdirectory of the directory where your code is running.


                    www.foo.com/player.html
                    www.foo.com/videos/video.mp4





                  2. Save a file in that subdirectory named ".htaccess" and add the lines below.




                    www.foo.com/videos/.htaccess




                    #Contents of .htaccess

                    RewriteEngine on
                    RewriteCond %{HTTP_REFERER} !^http://foo.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.foo.com/.*$ [NC]
                    RewriteRule .(mp4|mp3|avi)$ - [F]



                  Now the source link is useless, but we still need to make sure any user attempting to download the file cannot be directly served the file.





                  1. For a more complete solution, now serve the video with a flash player (or html canvas) and never link to the video directly. To just remove the right click menu, add to your HTML:



                    <body oncontextmenu="return false;">






                  The Result:



                  www.foo.com/player.html will correctly play video, but if you visit www.foo.com/videos/video.mp4:




                  Error Code 403: FORBIDDEN







                  This will work for direct download, cURL, hotlinking, you name it.



                  This is a complete answer to the two questions asked and not an answer to the question: "can I stop a user from downloading a video they have already downloaded."






                  share|improve this answer





















                  • 1





                    Great answer, but you have a ` that you should remove it from your .htaccess content

                    – MAZux
                    Jul 6 '17 at 8:22








                  • 1





                    You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                    – Shiroy
                    Sep 1 '17 at 18:34











                  • It seems still IDM can download it!

                    – PersianMan
                    Jun 24 '18 at 5:42











                  • @PersianMan Correct - I encourage you to read the first answers

                    – Tzshand
                    Jun 28 '18 at 1:59






                  • 1





                    Only works on Apache servers. No NGINX or IIS

                    – Nick
                    Jul 1 '18 at 15:22














                  21












                  21








                  21







                  Yes, you can do this in three steps:






                  1. Place the files you want to protect in a subdirectory of the directory where your code is running.


                    www.foo.com/player.html
                    www.foo.com/videos/video.mp4





                  2. Save a file in that subdirectory named ".htaccess" and add the lines below.




                    www.foo.com/videos/.htaccess




                    #Contents of .htaccess

                    RewriteEngine on
                    RewriteCond %{HTTP_REFERER} !^http://foo.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.foo.com/.*$ [NC]
                    RewriteRule .(mp4|mp3|avi)$ - [F]



                  Now the source link is useless, but we still need to make sure any user attempting to download the file cannot be directly served the file.





                  1. For a more complete solution, now serve the video with a flash player (or html canvas) and never link to the video directly. To just remove the right click menu, add to your HTML:



                    <body oncontextmenu="return false;">






                  The Result:



                  www.foo.com/player.html will correctly play video, but if you visit www.foo.com/videos/video.mp4:




                  Error Code 403: FORBIDDEN







                  This will work for direct download, cURL, hotlinking, you name it.



                  This is a complete answer to the two questions asked and not an answer to the question: "can I stop a user from downloading a video they have already downloaded."






                  share|improve this answer















                  Yes, you can do this in three steps:






                  1. Place the files you want to protect in a subdirectory of the directory where your code is running.


                    www.foo.com/player.html
                    www.foo.com/videos/video.mp4





                  2. Save a file in that subdirectory named ".htaccess" and add the lines below.




                    www.foo.com/videos/.htaccess




                    #Contents of .htaccess

                    RewriteEngine on
                    RewriteCond %{HTTP_REFERER} !^http://foo.com/.*$ [NC]
                    RewriteCond %{HTTP_REFERER} !^http://www.foo.com/.*$ [NC]
                    RewriteRule .(mp4|mp3|avi)$ - [F]



                  Now the source link is useless, but we still need to make sure any user attempting to download the file cannot be directly served the file.





                  1. For a more complete solution, now serve the video with a flash player (or html canvas) and never link to the video directly. To just remove the right click menu, add to your HTML:



                    <body oncontextmenu="return false;">






                  The Result:



                  www.foo.com/player.html will correctly play video, but if you visit www.foo.com/videos/video.mp4:




                  Error Code 403: FORBIDDEN







                  This will work for direct download, cURL, hotlinking, you name it.



                  This is a complete answer to the two questions asked and not an answer to the question: "can I stop a user from downloading a video they have already downloaded."







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 28 '17 at 14:35









                  Timo Schwarzer

                  299216




                  299216










                  answered Dec 25 '16 at 21:58









                  TzshandTzshand

                  1,077813




                  1,077813








                  • 1





                    Great answer, but you have a ` that you should remove it from your .htaccess content

                    – MAZux
                    Jul 6 '17 at 8:22








                  • 1





                    You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                    – Shiroy
                    Sep 1 '17 at 18:34











                  • It seems still IDM can download it!

                    – PersianMan
                    Jun 24 '18 at 5:42











                  • @PersianMan Correct - I encourage you to read the first answers

                    – Tzshand
                    Jun 28 '18 at 1:59






                  • 1





                    Only works on Apache servers. No NGINX or IIS

                    – Nick
                    Jul 1 '18 at 15:22














                  • 1





                    Great answer, but you have a ` that you should remove it from your .htaccess content

                    – MAZux
                    Jul 6 '17 at 8:22








                  • 1





                    You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                    – Shiroy
                    Sep 1 '17 at 18:34











                  • It seems still IDM can download it!

                    – PersianMan
                    Jun 24 '18 at 5:42











                  • @PersianMan Correct - I encourage you to read the first answers

                    – Tzshand
                    Jun 28 '18 at 1:59






                  • 1





                    Only works on Apache servers. No NGINX or IIS

                    – Nick
                    Jul 1 '18 at 15:22








                  1




                  1





                  Great answer, but you have a ` that you should remove it from your .htaccess content

                  – MAZux
                  Jul 6 '17 at 8:22







                  Great answer, but you have a ` that you should remove it from your .htaccess content

                  – MAZux
                  Jul 6 '17 at 8:22






                  1




                  1





                  You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                  – Shiroy
                  Sep 1 '17 at 18:34





                  You can still fake the HTTP Referer, which will allow a person to download. However, this is a very clever solution. If you club this with a one-time code on the file, you're good to go!

                  – Shiroy
                  Sep 1 '17 at 18:34













                  It seems still IDM can download it!

                  – PersianMan
                  Jun 24 '18 at 5:42





                  It seems still IDM can download it!

                  – PersianMan
                  Jun 24 '18 at 5:42













                  @PersianMan Correct - I encourage you to read the first answers

                  – Tzshand
                  Jun 28 '18 at 1:59





                  @PersianMan Correct - I encourage you to read the first answers

                  – Tzshand
                  Jun 28 '18 at 1:59




                  1




                  1





                  Only works on Apache servers. No NGINX or IIS

                  – Nick
                  Jul 1 '18 at 15:22





                  Only works on Apache servers. No NGINX or IIS

                  – Nick
                  Jul 1 '18 at 15:22











                  12














                  As a client-side developer I recommend to use blob URL,
                  blob URL is a client-side URL which refers to a binary object



                  <video id="id" width="320" height="240"  type='video/mp4' controls  > </video>


                  in HTML leave your video src blank,
                  and in JS fetch the video file using AJAX, make sure the response type is blob



                  window.onload = function() {
                  var xhr = new XMLHttpRequest();
                  xhr.open('GET', 'mov_bbb.mp4', true);
                  xhr.responseType = 'blob'; //important
                  xhr.onload = function(e) {
                  if (this.status == 200) {
                  console.log("loaded");
                  var blob = this.response;
                  var video = document.getElementById('id');
                  video.oncanplaythrough = function() {
                  console.log("Can play through video without stopping");
                  URL.revokeObjectURL(this.src);
                  };
                  video.src = URL.createObjectURL(blob);
                  video.load();
                  }
                  };
                  xhr.send();
                  }


                  Note: This method is not recommended for large file



                  EDIT




                  • Use cross-origin blocking for avoiding direct downloading


                  • if the video is delivered by an API Use different method (PUT/POST) instead of 'GET'







                  share|improve this answer





















                  • 3





                    YouTube uses Blob now too i think :) ?

                    – C0nw0nk
                    Jul 20 '17 at 22:13






                  • 1





                    Can you explain what's going on here more clearly and how to set up the server for this?

                    – Antoine
                    Dec 1 '17 at 1:21











                  • When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                    – Coderer
                    Apr 17 '18 at 10:03













                  • But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                    – Gleb Dolzikov
                    May 2 '18 at 12:59






                  • 1





                    @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                    – NerdOfCode
                    Jun 7 '18 at 4:48
















                  12














                  As a client-side developer I recommend to use blob URL,
                  blob URL is a client-side URL which refers to a binary object



                  <video id="id" width="320" height="240"  type='video/mp4' controls  > </video>


                  in HTML leave your video src blank,
                  and in JS fetch the video file using AJAX, make sure the response type is blob



                  window.onload = function() {
                  var xhr = new XMLHttpRequest();
                  xhr.open('GET', 'mov_bbb.mp4', true);
                  xhr.responseType = 'blob'; //important
                  xhr.onload = function(e) {
                  if (this.status == 200) {
                  console.log("loaded");
                  var blob = this.response;
                  var video = document.getElementById('id');
                  video.oncanplaythrough = function() {
                  console.log("Can play through video without stopping");
                  URL.revokeObjectURL(this.src);
                  };
                  video.src = URL.createObjectURL(blob);
                  video.load();
                  }
                  };
                  xhr.send();
                  }


                  Note: This method is not recommended for large file



                  EDIT




                  • Use cross-origin blocking for avoiding direct downloading


                  • if the video is delivered by an API Use different method (PUT/POST) instead of 'GET'







                  share|improve this answer





















                  • 3





                    YouTube uses Blob now too i think :) ?

                    – C0nw0nk
                    Jul 20 '17 at 22:13






                  • 1





                    Can you explain what's going on here more clearly and how to set up the server for this?

                    – Antoine
                    Dec 1 '17 at 1:21











                  • When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                    – Coderer
                    Apr 17 '18 at 10:03













                  • But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                    – Gleb Dolzikov
                    May 2 '18 at 12:59






                  • 1





                    @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                    – NerdOfCode
                    Jun 7 '18 at 4:48














                  12












                  12








                  12







                  As a client-side developer I recommend to use blob URL,
                  blob URL is a client-side URL which refers to a binary object



                  <video id="id" width="320" height="240"  type='video/mp4' controls  > </video>


                  in HTML leave your video src blank,
                  and in JS fetch the video file using AJAX, make sure the response type is blob



                  window.onload = function() {
                  var xhr = new XMLHttpRequest();
                  xhr.open('GET', 'mov_bbb.mp4', true);
                  xhr.responseType = 'blob'; //important
                  xhr.onload = function(e) {
                  if (this.status == 200) {
                  console.log("loaded");
                  var blob = this.response;
                  var video = document.getElementById('id');
                  video.oncanplaythrough = function() {
                  console.log("Can play through video without stopping");
                  URL.revokeObjectURL(this.src);
                  };
                  video.src = URL.createObjectURL(blob);
                  video.load();
                  }
                  };
                  xhr.send();
                  }


                  Note: This method is not recommended for large file



                  EDIT




                  • Use cross-origin blocking for avoiding direct downloading


                  • if the video is delivered by an API Use different method (PUT/POST) instead of 'GET'







                  share|improve this answer















                  As a client-side developer I recommend to use blob URL,
                  blob URL is a client-side URL which refers to a binary object



                  <video id="id" width="320" height="240"  type='video/mp4' controls  > </video>


                  in HTML leave your video src blank,
                  and in JS fetch the video file using AJAX, make sure the response type is blob



                  window.onload = function() {
                  var xhr = new XMLHttpRequest();
                  xhr.open('GET', 'mov_bbb.mp4', true);
                  xhr.responseType = 'blob'; //important
                  xhr.onload = function(e) {
                  if (this.status == 200) {
                  console.log("loaded");
                  var blob = this.response;
                  var video = document.getElementById('id');
                  video.oncanplaythrough = function() {
                  console.log("Can play through video without stopping");
                  URL.revokeObjectURL(this.src);
                  };
                  video.src = URL.createObjectURL(blob);
                  video.load();
                  }
                  };
                  xhr.send();
                  }


                  Note: This method is not recommended for large file



                  EDIT




                  • Use cross-origin blocking for avoiding direct downloading


                  • if the video is delivered by an API Use different method (PUT/POST) instead of 'GET'








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 14 at 19:09

























                  answered Jan 18 '17 at 6:20









                  SajanSajan

                  678812




                  678812








                  • 3





                    YouTube uses Blob now too i think :) ?

                    – C0nw0nk
                    Jul 20 '17 at 22:13






                  • 1





                    Can you explain what's going on here more clearly and how to set up the server for this?

                    – Antoine
                    Dec 1 '17 at 1:21











                  • When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                    – Coderer
                    Apr 17 '18 at 10:03













                  • But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                    – Gleb Dolzikov
                    May 2 '18 at 12:59






                  • 1





                    @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                    – NerdOfCode
                    Jun 7 '18 at 4:48














                  • 3





                    YouTube uses Blob now too i think :) ?

                    – C0nw0nk
                    Jul 20 '17 at 22:13






                  • 1





                    Can you explain what's going on here more clearly and how to set up the server for this?

                    – Antoine
                    Dec 1 '17 at 1:21











                  • When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                    – Coderer
                    Apr 17 '18 at 10:03













                  • But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                    – Gleb Dolzikov
                    May 2 '18 at 12:59






                  • 1





                    @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                    – NerdOfCode
                    Jun 7 '18 at 4:48








                  3




                  3





                  YouTube uses Blob now too i think :) ?

                  – C0nw0nk
                  Jul 20 '17 at 22:13





                  YouTube uses Blob now too i think :) ?

                  – C0nw0nk
                  Jul 20 '17 at 22:13




                  1




                  1





                  Can you explain what's going on here more clearly and how to set up the server for this?

                  – Antoine
                  Dec 1 '17 at 1:21





                  Can you explain what's going on here more clearly and how to set up the server for this?

                  – Antoine
                  Dec 1 '17 at 1:21













                  When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                  – Coderer
                  Apr 17 '18 at 10:03







                  When you download the blob via XHR, it's just bits in memory. The createObjectURL call creates a URL with the blob: scheme that can be used in the src attribute. The same method works with image files for an img tag. Now, keep in mind, whatever method you're using in your JS to generate / validate the XHR, a clever developer could do from the command line to grab your files. You can't stop downloads, but you can make them harder.

                  – Coderer
                  Apr 17 '18 at 10:03















                  But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                  – Gleb Dolzikov
                  May 2 '18 at 12:59





                  But you still execute it in client side and xhr.open('GET', 'mov_bbb.mp4', true); could be reached by a user in dev tools

                  – Gleb Dolzikov
                  May 2 '18 at 12:59




                  1




                  1





                  @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                  – NerdOfCode
                  Jun 7 '18 at 4:48





                  @JohnBalvinArias! I've not tested this 100%, but I'm going to say that it only needs a quick buffer... Don't quote me on this though...

                  – NerdOfCode
                  Jun 7 '18 at 4:48











                  10














                  PHP sends the html5 video tag together with a session where the key is a random string and the value is the filename.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $ogv=uniqid();
                  $_SESSION[$ogv]='myVideo.ogv';
                  $webm=uniqid();
                  $_SESSION[$webm]='myVideo.webm';
                  echo '<video autoplay="autoplay">'
                  .'<source src="video.php?video='.$ogv.' type="video/ogg">'
                  .'<source src="video.php?video='.$webm.' type="video/webm">'
                  .'</video>';


                  Now PHP is asked to send the video. PHP recovers the filename; deletes the session and sends the video instantly. Additionally all the 'no cache' and mime-type headers must be present.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $file='myhiddenvideos/'.$_SESSION[$_GET['video']];
                  $_SESSION=array();
                  $params = session_get_cookie_params();
                  setcookie(session_name(),'', time()-42000,$params["path"],$params["domain"],
                  $params["secure"], $params["httponly"]);
                  if(!file_exists($file) or $file==='' or !is_readable($file)){
                  header('HTTP/1.1 404 File not found',true);
                  exit;
                  }
                  readfile($file);
                  exit:


                  Now if the user copy the url in a new tab or use the context menu he will have no luck.






                  share|improve this answer


























                  • I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                    – user1252280
                    Dec 21 '17 at 20:48
















                  10














                  PHP sends the html5 video tag together with a session where the key is a random string and the value is the filename.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $ogv=uniqid();
                  $_SESSION[$ogv]='myVideo.ogv';
                  $webm=uniqid();
                  $_SESSION[$webm]='myVideo.webm';
                  echo '<video autoplay="autoplay">'
                  .'<source src="video.php?video='.$ogv.' type="video/ogg">'
                  .'<source src="video.php?video='.$webm.' type="video/webm">'
                  .'</video>';


                  Now PHP is asked to send the video. PHP recovers the filename; deletes the session and sends the video instantly. Additionally all the 'no cache' and mime-type headers must be present.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $file='myhiddenvideos/'.$_SESSION[$_GET['video']];
                  $_SESSION=array();
                  $params = session_get_cookie_params();
                  setcookie(session_name(),'', time()-42000,$params["path"],$params["domain"],
                  $params["secure"], $params["httponly"]);
                  if(!file_exists($file) or $file==='' or !is_readable($file)){
                  header('HTTP/1.1 404 File not found',true);
                  exit;
                  }
                  readfile($file);
                  exit:


                  Now if the user copy the url in a new tab or use the context menu he will have no luck.






                  share|improve this answer


























                  • I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                    – user1252280
                    Dec 21 '17 at 20:48














                  10












                  10








                  10







                  PHP sends the html5 video tag together with a session where the key is a random string and the value is the filename.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $ogv=uniqid();
                  $_SESSION[$ogv]='myVideo.ogv';
                  $webm=uniqid();
                  $_SESSION[$webm]='myVideo.webm';
                  echo '<video autoplay="autoplay">'
                  .'<source src="video.php?video='.$ogv.' type="video/ogg">'
                  .'<source src="video.php?video='.$webm.' type="video/webm">'
                  .'</video>';


                  Now PHP is asked to send the video. PHP recovers the filename; deletes the session and sends the video instantly. Additionally all the 'no cache' and mime-type headers must be present.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $file='myhiddenvideos/'.$_SESSION[$_GET['video']];
                  $_SESSION=array();
                  $params = session_get_cookie_params();
                  setcookie(session_name(),'', time()-42000,$params["path"],$params["domain"],
                  $params["secure"], $params["httponly"]);
                  if(!file_exists($file) or $file==='' or !is_readable($file)){
                  header('HTTP/1.1 404 File not found',true);
                  exit;
                  }
                  readfile($file);
                  exit:


                  Now if the user copy the url in a new tab or use the context menu he will have no luck.






                  share|improve this answer















                  PHP sends the html5 video tag together with a session where the key is a random string and the value is the filename.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $ogv=uniqid();
                  $_SESSION[$ogv]='myVideo.ogv';
                  $webm=uniqid();
                  $_SESSION[$webm]='myVideo.webm';
                  echo '<video autoplay="autoplay">'
                  .'<source src="video.php?video='.$ogv.' type="video/ogg">'
                  .'<source src="video.php?video='.$webm.' type="video/webm">'
                  .'</video>';


                  Now PHP is asked to send the video. PHP recovers the filename; deletes the session and sends the video instantly. Additionally all the 'no cache' and mime-type headers must be present.



                  ini_set('session.use_cookies',1);
                  session_start();
                  $file='myhiddenvideos/'.$_SESSION[$_GET['video']];
                  $_SESSION=array();
                  $params = session_get_cookie_params();
                  setcookie(session_name(),'', time()-42000,$params["path"],$params["domain"],
                  $params["secure"], $params["httponly"]);
                  if(!file_exists($file) or $file==='' or !is_readable($file)){
                  header('HTTP/1.1 404 File not found',true);
                  exit;
                  }
                  readfile($file);
                  exit:


                  Now if the user copy the url in a new tab or use the context menu he will have no luck.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 12 '14 at 10:02

























                  answered Nov 4 '14 at 9:07









                  B.F.B.F.

                  37958




                  37958













                  • I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                    – user1252280
                    Dec 21 '17 at 20:48



















                  • I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                    – user1252280
                    Dec 21 '17 at 20:48

















                  I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                  – user1252280
                  Dec 21 '17 at 20:48





                  I like the solution- it solves OPs question. One unfortunate thing is, when the checks the source code in Chrome and right-clicks on the link. The user will download a html file, which in fact will be the video file.

                  – user1252280
                  Dec 21 '17 at 20:48











                  5














                  You can at least stop the the non-tech savvy people from using the right-click context menu to download your video. You can disable the context menu for any element using the oncontextmenu attribute.



                  oncontextmenu="return false;"


                  This works for the body element (whole page) or just a single video using it inside the video tag.



                  <video oncontextmenu="return false;" controls>...</video>





                  share|improve this answer






























                    5














                    You can at least stop the the non-tech savvy people from using the right-click context menu to download your video. You can disable the context menu for any element using the oncontextmenu attribute.



                    oncontextmenu="return false;"


                    This works for the body element (whole page) or just a single video using it inside the video tag.



                    <video oncontextmenu="return false;" controls>...</video>





                    share|improve this answer




























                      5












                      5








                      5







                      You can at least stop the the non-tech savvy people from using the right-click context menu to download your video. You can disable the context menu for any element using the oncontextmenu attribute.



                      oncontextmenu="return false;"


                      This works for the body element (whole page) or just a single video using it inside the video tag.



                      <video oncontextmenu="return false;" controls>...</video>





                      share|improve this answer















                      You can at least stop the the non-tech savvy people from using the right-click context menu to download your video. You can disable the context menu for any element using the oncontextmenu attribute.



                      oncontextmenu="return false;"


                      This works for the body element (whole page) or just a single video using it inside the video tag.



                      <video oncontextmenu="return false;" controls>...</video>






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 2 '16 at 15:59

























                      answered Jun 2 '16 at 15:49









                      TxRegexTxRegex

                      1,7521416




                      1,7521416























                          3














                          +1 simple and cross-browser way:
                          You can also put transparent picture over the video with css z-index and opacity.
                          So users will see "save picture as" instead of "save video" in context menu.






                          share|improve this answer



















                          • 1





                            why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                            – Waqas Tahir
                            Dec 31 '15 at 5:57











                          • I am not sure but still video can be downloaded via File>SaveAs

                            – Arun Kumar
                            Aug 10 '16 at 11:13
















                          3














                          +1 simple and cross-browser way:
                          You can also put transparent picture over the video with css z-index and opacity.
                          So users will see "save picture as" instead of "save video" in context menu.






                          share|improve this answer



















                          • 1





                            why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                            – Waqas Tahir
                            Dec 31 '15 at 5:57











                          • I am not sure but still video can be downloaded via File>SaveAs

                            – Arun Kumar
                            Aug 10 '16 at 11:13














                          3












                          3








                          3







                          +1 simple and cross-browser way:
                          You can also put transparent picture over the video with css z-index and opacity.
                          So users will see "save picture as" instead of "save video" in context menu.






                          share|improve this answer













                          +1 simple and cross-browser way:
                          You can also put transparent picture over the video with css z-index and opacity.
                          So users will see "save picture as" instead of "save video" in context menu.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 31 '15 at 22:24









                          Alex BabakAlex Babak

                          389114




                          389114








                          • 1





                            why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                            – Waqas Tahir
                            Dec 31 '15 at 5:57











                          • I am not sure but still video can be downloaded via File>SaveAs

                            – Arun Kumar
                            Aug 10 '16 at 11:13














                          • 1





                            why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                            – Waqas Tahir
                            Dec 31 '15 at 5:57











                          • I am not sure but still video can be downloaded via File>SaveAs

                            – Arun Kumar
                            Aug 10 '16 at 11:13








                          1




                          1





                          why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                          – Waqas Tahir
                          Dec 31 '15 at 5:57





                          why pic it will take time to load so only put the div tag and they will get a big menu of chrome like back reload etc

                          – Waqas Tahir
                          Dec 31 '15 at 5:57













                          I am not sure but still video can be downloaded via File>SaveAs

                          – Arun Kumar
                          Aug 10 '16 at 11:13





                          I am not sure but still video can be downloaded via File>SaveAs

                          – Arun Kumar
                          Aug 10 '16 at 11:13











                          3














                          We ended up using AWS CloudFront with expiring URLs. The video will load, but by the time the user right clicks and chooses Save As the video url they initially received has expired. Do a search for CloudFront Origin Access Identity.



                          Producing the video url requires a key pair which can be created in the AWS CLI. FYI this is not my code but it works great!



                          $resource = 'http://cdn.yourwebsite.com/videos/yourvideourl.mp4';
                          $timeout = 4;

                          //This comes from key pair you generated for cloudfront
                          $keyPairId = "AKAJSDHFKASWERASDF";

                          $expires = time() + $timeout; //Time out in seconds
                          $json = '{"Statement":[{"Resource":"'.$resource.'","Condition" {"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';

                          //Read Cloudfront Private Key Pair
                          $fp=fopen("/absolute/path/to/your/cloudfront_privatekey.pem","r");
                          $priv_key=fread($fp,8192);
                          fclose($fp);

                          //Create the private key
                          $key = openssl_get_privatekey($priv_key);
                          if(!$key)
                          {
                          echo "<p>Failed to load private key!</p>";
                          return;
                          }

                          //Sign the policy with the private key
                          if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1))
                          {
                          echo '<p>Failed to sign policy: '.openssl_error_string().'</p>';
                          return;
                          }

                          //Create url safe signed policy
                          $base64_signed_policy = base64_encode($signed_policy);
                          $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy);

                          //Construct the URL
                          $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId;

                          return '<div class="videowrapper" ><video autoplay controls style="width:100%!important;height:auto!important;"><source src="'.$url.'" type="video/mp4">Your browser does not support the video tag.</video></div>';





                          share|improve this answer
























                          • Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                            – Zmart
                            Oct 18 '18 at 3:29











                          • If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                            – Chud37
                            Apr 5 at 12:27
















                          3














                          We ended up using AWS CloudFront with expiring URLs. The video will load, but by the time the user right clicks and chooses Save As the video url they initially received has expired. Do a search for CloudFront Origin Access Identity.



                          Producing the video url requires a key pair which can be created in the AWS CLI. FYI this is not my code but it works great!



                          $resource = 'http://cdn.yourwebsite.com/videos/yourvideourl.mp4';
                          $timeout = 4;

                          //This comes from key pair you generated for cloudfront
                          $keyPairId = "AKAJSDHFKASWERASDF";

                          $expires = time() + $timeout; //Time out in seconds
                          $json = '{"Statement":[{"Resource":"'.$resource.'","Condition" {"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';

                          //Read Cloudfront Private Key Pair
                          $fp=fopen("/absolute/path/to/your/cloudfront_privatekey.pem","r");
                          $priv_key=fread($fp,8192);
                          fclose($fp);

                          //Create the private key
                          $key = openssl_get_privatekey($priv_key);
                          if(!$key)
                          {
                          echo "<p>Failed to load private key!</p>";
                          return;
                          }

                          //Sign the policy with the private key
                          if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1))
                          {
                          echo '<p>Failed to sign policy: '.openssl_error_string().'</p>';
                          return;
                          }

                          //Create url safe signed policy
                          $base64_signed_policy = base64_encode($signed_policy);
                          $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy);

                          //Construct the URL
                          $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId;

                          return '<div class="videowrapper" ><video autoplay controls style="width:100%!important;height:auto!important;"><source src="'.$url.'" type="video/mp4">Your browser does not support the video tag.</video></div>';





                          share|improve this answer
























                          • Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                            – Zmart
                            Oct 18 '18 at 3:29











                          • If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                            – Chud37
                            Apr 5 at 12:27














                          3












                          3








                          3







                          We ended up using AWS CloudFront with expiring URLs. The video will load, but by the time the user right clicks and chooses Save As the video url they initially received has expired. Do a search for CloudFront Origin Access Identity.



                          Producing the video url requires a key pair which can be created in the AWS CLI. FYI this is not my code but it works great!



                          $resource = 'http://cdn.yourwebsite.com/videos/yourvideourl.mp4';
                          $timeout = 4;

                          //This comes from key pair you generated for cloudfront
                          $keyPairId = "AKAJSDHFKASWERASDF";

                          $expires = time() + $timeout; //Time out in seconds
                          $json = '{"Statement":[{"Resource":"'.$resource.'","Condition" {"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';

                          //Read Cloudfront Private Key Pair
                          $fp=fopen("/absolute/path/to/your/cloudfront_privatekey.pem","r");
                          $priv_key=fread($fp,8192);
                          fclose($fp);

                          //Create the private key
                          $key = openssl_get_privatekey($priv_key);
                          if(!$key)
                          {
                          echo "<p>Failed to load private key!</p>";
                          return;
                          }

                          //Sign the policy with the private key
                          if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1))
                          {
                          echo '<p>Failed to sign policy: '.openssl_error_string().'</p>';
                          return;
                          }

                          //Create url safe signed policy
                          $base64_signed_policy = base64_encode($signed_policy);
                          $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy);

                          //Construct the URL
                          $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId;

                          return '<div class="videowrapper" ><video autoplay controls style="width:100%!important;height:auto!important;"><source src="'.$url.'" type="video/mp4">Your browser does not support the video tag.</video></div>';





                          share|improve this answer













                          We ended up using AWS CloudFront with expiring URLs. The video will load, but by the time the user right clicks and chooses Save As the video url they initially received has expired. Do a search for CloudFront Origin Access Identity.



                          Producing the video url requires a key pair which can be created in the AWS CLI. FYI this is not my code but it works great!



                          $resource = 'http://cdn.yourwebsite.com/videos/yourvideourl.mp4';
                          $timeout = 4;

                          //This comes from key pair you generated for cloudfront
                          $keyPairId = "AKAJSDHFKASWERASDF";

                          $expires = time() + $timeout; //Time out in seconds
                          $json = '{"Statement":[{"Resource":"'.$resource.'","Condition" {"DateLessThan":{"AWS:EpochTime":'.$expires.'}}}]}';

                          //Read Cloudfront Private Key Pair
                          $fp=fopen("/absolute/path/to/your/cloudfront_privatekey.pem","r");
                          $priv_key=fread($fp,8192);
                          fclose($fp);

                          //Create the private key
                          $key = openssl_get_privatekey($priv_key);
                          if(!$key)
                          {
                          echo "<p>Failed to load private key!</p>";
                          return;
                          }

                          //Sign the policy with the private key
                          if(!openssl_sign($json, $signed_policy, $key, OPENSSL_ALGO_SHA1))
                          {
                          echo '<p>Failed to sign policy: '.openssl_error_string().'</p>';
                          return;
                          }

                          //Create url safe signed policy
                          $base64_signed_policy = base64_encode($signed_policy);
                          $signature = str_replace(array('+','=','/'), array('-','_','~'), $base64_signed_policy);

                          //Construct the URL
                          $url = $resource.'?Expires='.$expires.'&Signature='.$signature.'&Key-Pair-Id='.$keyPairId;

                          return '<div class="videowrapper" ><video autoplay controls style="width:100%!important;height:auto!important;"><source src="'.$url.'" type="video/mp4">Your browser does not support the video tag.</video></div>';






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 28 '16 at 18:32









                          prophotoprophoto

                          848




                          848













                          • Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                            – Zmart
                            Oct 18 '18 at 3:29











                          • If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                            – Chud37
                            Apr 5 at 12:27



















                          • Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                            – Zmart
                            Oct 18 '18 at 3:29











                          • If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                            – Chud37
                            Apr 5 at 12:27

















                          Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                          – Zmart
                          Oct 18 '18 at 3:29





                          Highly underrated comment. I'd advise using docs.aws.amazon.com/sdk-for-php/v3/developer-guide/… nowadays however.

                          – Zmart
                          Oct 18 '18 at 3:29













                          If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                          – Chud37
                          Apr 5 at 12:27





                          If the token expires, does that mean they cannot navigate around the video either? As this seems to contact the video URL again.

                          – Chud37
                          Apr 5 at 12:27











                          2














                          Using a service such as Vimeo: Sign in Vimeo > Goto Video > Settings > Privacy > Mark as Secured, and also select embed domains. Once the embed domains are set, it will not allow anyone to embed the video or display it from the browser unless connecting from the domains specified. So, if you have a page that is secured on your server which loads the Vimeo player in iframe, this makes it pretty difficult to get around.






                          share|improve this answer






























                            2














                            Using a service such as Vimeo: Sign in Vimeo > Goto Video > Settings > Privacy > Mark as Secured, and also select embed domains. Once the embed domains are set, it will not allow anyone to embed the video or display it from the browser unless connecting from the domains specified. So, if you have a page that is secured on your server which loads the Vimeo player in iframe, this makes it pretty difficult to get around.






                            share|improve this answer




























                              2












                              2








                              2







                              Using a service such as Vimeo: Sign in Vimeo > Goto Video > Settings > Privacy > Mark as Secured, and also select embed domains. Once the embed domains are set, it will not allow anyone to embed the video or display it from the browser unless connecting from the domains specified. So, if you have a page that is secured on your server which loads the Vimeo player in iframe, this makes it pretty difficult to get around.






                              share|improve this answer















                              Using a service such as Vimeo: Sign in Vimeo > Goto Video > Settings > Privacy > Mark as Secured, and also select embed domains. Once the embed domains are set, it will not allow anyone to embed the video or display it from the browser unless connecting from the domains specified. So, if you have a page that is secured on your server which loads the Vimeo player in iframe, this makes it pretty difficult to get around.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Sep 5 '14 at 12:15









                              user2771704

                              3,95352736




                              3,95352736










                              answered Sep 5 '14 at 11:54









                              CommentUserCommentUser

                              291




                              291























                                  2














                                  First of all realise it is impossible to completely prevent a video being downloaded, all you can do is make it more difficult. I.e. you hide the source of the video.



                                  A web browser temporarily downloads the video in a buffer, so if could prevent download you would also be preventing the video being viewed as well.



                                  You should also know that <1% of the total population of the world will be able to understand the source code making it rather safe anyway. That does not mean you should not hide it in the source as well - you should.



                                  You should not disable right click, and even less you should display a message saying "You cannot save this video for copyright reasons. Sorry about that.". As suggested in this answer.



                                  This can be very annoying and confusing for the user. Apart from that; if they disable JavaScript on their browser they will be able to right click and save anyway.



                                  Here is a CSS trick you could use:



                                  video {
                                  pointer-events: none;
                                  }


                                  CSS cannot be turned off in browser, protecting your video without actually disabling right click. However one problem is that controls cannot be enabled either, in other words they must be set to false. If you are going to inplament your own Play/Pause function or use an API that has buttons separate to the video tag then this is a feasible option.



                                  controls also has a download button so using it is not such a good idea either.



                                  Here is a JSFiddle example.





                                  If you are going to disable right click using JavaScript then also store the source of the video in JavaScript as well. That way if the user disables JavaScript (allowing right click) the video will not load (it also hides the video source a little better).



                                  From TxRegex answer:



                                  <video oncontextmenu="return false;" controls>
                                  <source type="video/mp4" id="video">
                                  </video>


                                  Now add the video via JavaScript:



                                  document.getElementById("video").src = "https://www.w3schools.com/html/mov_bbb.mp4";


                                  Functional JSFiddle





                                  Another way to prevent right click involves using the embed tag. This is does not however provide the controls to run the video so they would need to be inplamented in JavaScript:



                                  <embed src="https://www.w3schools.com/html/mov_bbb.mp4"></embed>





                                  share|improve this answer



















                                  • 1





                                    Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                    – Simone
                                    Feb 26 at 8:14











                                  • @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                    – Simon
                                    Feb 26 at 11:37


















                                  2














                                  First of all realise it is impossible to completely prevent a video being downloaded, all you can do is make it more difficult. I.e. you hide the source of the video.



                                  A web browser temporarily downloads the video in a buffer, so if could prevent download you would also be preventing the video being viewed as well.



                                  You should also know that <1% of the total population of the world will be able to understand the source code making it rather safe anyway. That does not mean you should not hide it in the source as well - you should.



                                  You should not disable right click, and even less you should display a message saying "You cannot save this video for copyright reasons. Sorry about that.". As suggested in this answer.



                                  This can be very annoying and confusing for the user. Apart from that; if they disable JavaScript on their browser they will be able to right click and save anyway.



                                  Here is a CSS trick you could use:



                                  video {
                                  pointer-events: none;
                                  }


                                  CSS cannot be turned off in browser, protecting your video without actually disabling right click. However one problem is that controls cannot be enabled either, in other words they must be set to false. If you are going to inplament your own Play/Pause function or use an API that has buttons separate to the video tag then this is a feasible option.



                                  controls also has a download button so using it is not such a good idea either.



                                  Here is a JSFiddle example.





                                  If you are going to disable right click using JavaScript then also store the source of the video in JavaScript as well. That way if the user disables JavaScript (allowing right click) the video will not load (it also hides the video source a little better).



                                  From TxRegex answer:



                                  <video oncontextmenu="return false;" controls>
                                  <source type="video/mp4" id="video">
                                  </video>


                                  Now add the video via JavaScript:



                                  document.getElementById("video").src = "https://www.w3schools.com/html/mov_bbb.mp4";


                                  Functional JSFiddle





                                  Another way to prevent right click involves using the embed tag. This is does not however provide the controls to run the video so they would need to be inplamented in JavaScript:



                                  <embed src="https://www.w3schools.com/html/mov_bbb.mp4"></embed>





                                  share|improve this answer



















                                  • 1





                                    Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                    – Simone
                                    Feb 26 at 8:14











                                  • @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                    – Simon
                                    Feb 26 at 11:37
















                                  2












                                  2








                                  2







                                  First of all realise it is impossible to completely prevent a video being downloaded, all you can do is make it more difficult. I.e. you hide the source of the video.



                                  A web browser temporarily downloads the video in a buffer, so if could prevent download you would also be preventing the video being viewed as well.



                                  You should also know that <1% of the total population of the world will be able to understand the source code making it rather safe anyway. That does not mean you should not hide it in the source as well - you should.



                                  You should not disable right click, and even less you should display a message saying "You cannot save this video for copyright reasons. Sorry about that.". As suggested in this answer.



                                  This can be very annoying and confusing for the user. Apart from that; if they disable JavaScript on their browser they will be able to right click and save anyway.



                                  Here is a CSS trick you could use:



                                  video {
                                  pointer-events: none;
                                  }


                                  CSS cannot be turned off in browser, protecting your video without actually disabling right click. However one problem is that controls cannot be enabled either, in other words they must be set to false. If you are going to inplament your own Play/Pause function or use an API that has buttons separate to the video tag then this is a feasible option.



                                  controls also has a download button so using it is not such a good idea either.



                                  Here is a JSFiddle example.





                                  If you are going to disable right click using JavaScript then also store the source of the video in JavaScript as well. That way if the user disables JavaScript (allowing right click) the video will not load (it also hides the video source a little better).



                                  From TxRegex answer:



                                  <video oncontextmenu="return false;" controls>
                                  <source type="video/mp4" id="video">
                                  </video>


                                  Now add the video via JavaScript:



                                  document.getElementById("video").src = "https://www.w3schools.com/html/mov_bbb.mp4";


                                  Functional JSFiddle





                                  Another way to prevent right click involves using the embed tag. This is does not however provide the controls to run the video so they would need to be inplamented in JavaScript:



                                  <embed src="https://www.w3schools.com/html/mov_bbb.mp4"></embed>





                                  share|improve this answer













                                  First of all realise it is impossible to completely prevent a video being downloaded, all you can do is make it more difficult. I.e. you hide the source of the video.



                                  A web browser temporarily downloads the video in a buffer, so if could prevent download you would also be preventing the video being viewed as well.



                                  You should also know that <1% of the total population of the world will be able to understand the source code making it rather safe anyway. That does not mean you should not hide it in the source as well - you should.



                                  You should not disable right click, and even less you should display a message saying "You cannot save this video for copyright reasons. Sorry about that.". As suggested in this answer.



                                  This can be very annoying and confusing for the user. Apart from that; if they disable JavaScript on their browser they will be able to right click and save anyway.



                                  Here is a CSS trick you could use:



                                  video {
                                  pointer-events: none;
                                  }


                                  CSS cannot be turned off in browser, protecting your video without actually disabling right click. However one problem is that controls cannot be enabled either, in other words they must be set to false. If you are going to inplament your own Play/Pause function or use an API that has buttons separate to the video tag then this is a feasible option.



                                  controls also has a download button so using it is not such a good idea either.



                                  Here is a JSFiddle example.





                                  If you are going to disable right click using JavaScript then also store the source of the video in JavaScript as well. That way if the user disables JavaScript (allowing right click) the video will not load (it also hides the video source a little better).



                                  From TxRegex answer:



                                  <video oncontextmenu="return false;" controls>
                                  <source type="video/mp4" id="video">
                                  </video>


                                  Now add the video via JavaScript:



                                  document.getElementById("video").src = "https://www.w3schools.com/html/mov_bbb.mp4";


                                  Functional JSFiddle





                                  Another way to prevent right click involves using the embed tag. This is does not however provide the controls to run the video so they would need to be inplamented in JavaScript:



                                  <embed src="https://www.w3schools.com/html/mov_bbb.mp4"></embed>






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Mar 17 '18 at 0:14









                                  SimonSimon

                                  5,67262946




                                  5,67262946








                                  • 1





                                    Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                    – Simone
                                    Feb 26 at 8:14











                                  • @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                    – Simon
                                    Feb 26 at 11:37
















                                  • 1





                                    Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                    – Simone
                                    Feb 26 at 8:14











                                  • @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                    – Simon
                                    Feb 26 at 11:37










                                  1




                                  1





                                  Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                  – Simone
                                  Feb 26 at 8:14





                                  Adding the src URL via JavaScript is not much useful. Inspecting the DOM will show the URL in plain sight after the script set it.

                                  – Simone
                                  Feb 26 at 8:14













                                  @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                  – Simon
                                  Feb 26 at 11:37







                                  @Simone I agree, however it is better than showing it directly in the html source, where anybody that right clicks it can see it immediatly. You could always split up the url or encrypt it. But remember that is additional processing

                                  – Simon
                                  Feb 26 at 11:37













                                  2














                                  The



                                  <body oncontextmenu="return false;"> 


                                  no longer works. Chrome and Opera as of June 2018 has a submenu on the timeline to allow straight download, so user doesn't need to right click to download that video. Interestingly Firefox and Edge don't have this ...






                                  share|improve this answer




























                                    2














                                    The



                                    <body oncontextmenu="return false;"> 


                                    no longer works. Chrome and Opera as of June 2018 has a submenu on the timeline to allow straight download, so user doesn't need to right click to download that video. Interestingly Firefox and Edge don't have this ...






                                    share|improve this answer


























                                      2












                                      2








                                      2







                                      The



                                      <body oncontextmenu="return false;"> 


                                      no longer works. Chrome and Opera as of June 2018 has a submenu on the timeline to allow straight download, so user doesn't need to right click to download that video. Interestingly Firefox and Edge don't have this ...






                                      share|improve this answer













                                      The



                                      <body oncontextmenu="return false;"> 


                                      no longer works. Chrome and Opera as of June 2018 has a submenu on the timeline to allow straight download, so user doesn't need to right click to download that video. Interestingly Firefox and Edge don't have this ...







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 18 '18 at 10:45









                                      kendolewkendolew

                                      764




                                      764























                                          1














                                          Short Answer: Encrypt the link like youtube does, don't know how than ask youtube/google of how they do it. (Just in case you want to get straight into the point.)



                                          I would like to point out to anyone that this is possible because youtube does it and if they can so can any other website and it isn't from the browser either because I tested it on a couple browsers such as microsoft edge and internet explorer and so there is a way to disable it and seen that people still say it...I tries looking for an answer because if youtube can than there has to be a way and the only way to see how they do it is if someone looked into the scripts of youtube which I am doing now. I also checked to see if it was a custom context menu as well and it isn't because the context menu is over flowing the inspect element and I mean like it is over it and I looked and it never creates a new class and also it is impossible to actually access inspect element with javascript so it can't be. You can tell when it double right-click a youtube video that it pops up the context menu for chrome. Besides...youtube wouldn't add that function in. I am doing research and looking through the source of youtube so I will be back if I find the answer...if anyone says you can't than, well they didn't do research like I have. The only way to download youtube videos is through a video download.



                                          Okay...I did research and my research stays that you can disable it except there is no javascript to it...you have to be able to encrypt the links to the video for you to be able to disable it because I think any browser won't show it if it can't find it and when I opened a youtube video link it showed as this "blob:https://www.youtube.com/e5c4808e-297e-451f-80da-3e838caa1275" without quotes so it is encrypting it so it cannot be saved...you need to know php for that but like the answer you picked out of making it harder, youtube makes it the hardest of heavy encrypting it, you need to be an advance php programmer but if you don't know that than take the person you picked as best answer of making it hard to download it...but if you know php than heavy encrypt the video link so it only is able to be read on yours...I don't know how to explain how they do it but they did and there is a way. The way youtube Encrypts there videos is quite smart so if you want to know how to than just ask youtube/google of how they do it...hope this helps for you although you already picked a best answer. So encrypting the link is best in short terms.






                                          share|improve this answer






























                                            1














                                            Short Answer: Encrypt the link like youtube does, don't know how than ask youtube/google of how they do it. (Just in case you want to get straight into the point.)



                                            I would like to point out to anyone that this is possible because youtube does it and if they can so can any other website and it isn't from the browser either because I tested it on a couple browsers such as microsoft edge and internet explorer and so there is a way to disable it and seen that people still say it...I tries looking for an answer because if youtube can than there has to be a way and the only way to see how they do it is if someone looked into the scripts of youtube which I am doing now. I also checked to see if it was a custom context menu as well and it isn't because the context menu is over flowing the inspect element and I mean like it is over it and I looked and it never creates a new class and also it is impossible to actually access inspect element with javascript so it can't be. You can tell when it double right-click a youtube video that it pops up the context menu for chrome. Besides...youtube wouldn't add that function in. I am doing research and looking through the source of youtube so I will be back if I find the answer...if anyone says you can't than, well they didn't do research like I have. The only way to download youtube videos is through a video download.



                                            Okay...I did research and my research stays that you can disable it except there is no javascript to it...you have to be able to encrypt the links to the video for you to be able to disable it because I think any browser won't show it if it can't find it and when I opened a youtube video link it showed as this "blob:https://www.youtube.com/e5c4808e-297e-451f-80da-3e838caa1275" without quotes so it is encrypting it so it cannot be saved...you need to know php for that but like the answer you picked out of making it harder, youtube makes it the hardest of heavy encrypting it, you need to be an advance php programmer but if you don't know that than take the person you picked as best answer of making it hard to download it...but if you know php than heavy encrypt the video link so it only is able to be read on yours...I don't know how to explain how they do it but they did and there is a way. The way youtube Encrypts there videos is quite smart so if you want to know how to than just ask youtube/google of how they do it...hope this helps for you although you already picked a best answer. So encrypting the link is best in short terms.






                                            share|improve this answer




























                                              1












                                              1








                                              1







                                              Short Answer: Encrypt the link like youtube does, don't know how than ask youtube/google of how they do it. (Just in case you want to get straight into the point.)



                                              I would like to point out to anyone that this is possible because youtube does it and if they can so can any other website and it isn't from the browser either because I tested it on a couple browsers such as microsoft edge and internet explorer and so there is a way to disable it and seen that people still say it...I tries looking for an answer because if youtube can than there has to be a way and the only way to see how they do it is if someone looked into the scripts of youtube which I am doing now. I also checked to see if it was a custom context menu as well and it isn't because the context menu is over flowing the inspect element and I mean like it is over it and I looked and it never creates a new class and also it is impossible to actually access inspect element with javascript so it can't be. You can tell when it double right-click a youtube video that it pops up the context menu for chrome. Besides...youtube wouldn't add that function in. I am doing research and looking through the source of youtube so I will be back if I find the answer...if anyone says you can't than, well they didn't do research like I have. The only way to download youtube videos is through a video download.



                                              Okay...I did research and my research stays that you can disable it except there is no javascript to it...you have to be able to encrypt the links to the video for you to be able to disable it because I think any browser won't show it if it can't find it and when I opened a youtube video link it showed as this "blob:https://www.youtube.com/e5c4808e-297e-451f-80da-3e838caa1275" without quotes so it is encrypting it so it cannot be saved...you need to know php for that but like the answer you picked out of making it harder, youtube makes it the hardest of heavy encrypting it, you need to be an advance php programmer but if you don't know that than take the person you picked as best answer of making it hard to download it...but if you know php than heavy encrypt the video link so it only is able to be read on yours...I don't know how to explain how they do it but they did and there is a way. The way youtube Encrypts there videos is quite smart so if you want to know how to than just ask youtube/google of how they do it...hope this helps for you although you already picked a best answer. So encrypting the link is best in short terms.






                                              share|improve this answer















                                              Short Answer: Encrypt the link like youtube does, don't know how than ask youtube/google of how they do it. (Just in case you want to get straight into the point.)



                                              I would like to point out to anyone that this is possible because youtube does it and if they can so can any other website and it isn't from the browser either because I tested it on a couple browsers such as microsoft edge and internet explorer and so there is a way to disable it and seen that people still say it...I tries looking for an answer because if youtube can than there has to be a way and the only way to see how they do it is if someone looked into the scripts of youtube which I am doing now. I also checked to see if it was a custom context menu as well and it isn't because the context menu is over flowing the inspect element and I mean like it is over it and I looked and it never creates a new class and also it is impossible to actually access inspect element with javascript so it can't be. You can tell when it double right-click a youtube video that it pops up the context menu for chrome. Besides...youtube wouldn't add that function in. I am doing research and looking through the source of youtube so I will be back if I find the answer...if anyone says you can't than, well they didn't do research like I have. The only way to download youtube videos is through a video download.



                                              Okay...I did research and my research stays that you can disable it except there is no javascript to it...you have to be able to encrypt the links to the video for you to be able to disable it because I think any browser won't show it if it can't find it and when I opened a youtube video link it showed as this "blob:https://www.youtube.com/e5c4808e-297e-451f-80da-3e838caa1275" without quotes so it is encrypting it so it cannot be saved...you need to know php for that but like the answer you picked out of making it harder, youtube makes it the hardest of heavy encrypting it, you need to be an advance php programmer but if you don't know that than take the person you picked as best answer of making it hard to download it...but if you know php than heavy encrypt the video link so it only is able to be read on yours...I don't know how to explain how they do it but they did and there is a way. The way youtube Encrypts there videos is quite smart so if you want to know how to than just ask youtube/google of how they do it...hope this helps for you although you already picked a best answer. So encrypting the link is best in short terms.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Nov 4 '18 at 16:10

























                                              answered Nov 4 '18 at 15:57









                                              Jonathan J. PecanyJonathan J. Pecany

                                              367




                                              367























                                                  0














                                                  It seems like streaming the video through websocket is a viable option, as in stream the frames and draw them on a canvas sort of thing.



                                                  Video streaming over websockets using JavaScript



                                                  I think that would provide another level of protection making it more difficult for the client to acquire the video and of course solve your problem with "Save video as..." right-click context menu option ( overkill ?! ).






                                                  share|improve this answer






























                                                    0














                                                    It seems like streaming the video through websocket is a viable option, as in stream the frames and draw them on a canvas sort of thing.



                                                    Video streaming over websockets using JavaScript



                                                    I think that would provide another level of protection making it more difficult for the client to acquire the video and of course solve your problem with "Save video as..." right-click context menu option ( overkill ?! ).






                                                    share|improve this answer




























                                                      0












                                                      0








                                                      0







                                                      It seems like streaming the video through websocket is a viable option, as in stream the frames and draw them on a canvas sort of thing.



                                                      Video streaming over websockets using JavaScript



                                                      I think that would provide another level of protection making it more difficult for the client to acquire the video and of course solve your problem with "Save video as..." right-click context menu option ( overkill ?! ).






                                                      share|improve this answer















                                                      It seems like streaming the video through websocket is a viable option, as in stream the frames and draw them on a canvas sort of thing.



                                                      Video streaming over websockets using JavaScript



                                                      I think that would provide another level of protection making it more difficult for the client to acquire the video and of course solve your problem with "Save video as..." right-click context menu option ( overkill ?! ).







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited May 23 '17 at 12:34









                                                      Community

                                                      11




                                                      11










                                                      answered Dec 11 '15 at 2:38









                                                      GuyGuy

                                                      565611




                                                      565611























                                                          0














                                                          Here's what I did:






                                                          function noRightClick() {
                                                          alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                          }

                                                              <body oncontextmenu="noRightClick();">
                                                          <video>
                                                          <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                          </video>
                                                          </body>




                                                          This also works for images, text and pretty much anything. However, you can still access the "Inspect" and the "View source" tool through keyboard shortcuts. (As the answer at the top says, you can't stop it entirely.) But you can try to put barriers up to stop them.




                                                          share|improve this answer




























                                                            0














                                                            Here's what I did:






                                                            function noRightClick() {
                                                            alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                            }

                                                                <body oncontextmenu="noRightClick();">
                                                            <video>
                                                            <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                            </video>
                                                            </body>




                                                            This also works for images, text and pretty much anything. However, you can still access the "Inspect" and the "View source" tool through keyboard shortcuts. (As the answer at the top says, you can't stop it entirely.) But you can try to put barriers up to stop them.




                                                            share|improve this answer


























                                                              0












                                                              0








                                                              0







                                                              Here's what I did:






                                                              function noRightClick() {
                                                              alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                              }

                                                                  <body oncontextmenu="noRightClick();">
                                                              <video>
                                                              <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                              </video>
                                                              </body>




                                                              This also works for images, text and pretty much anything. However, you can still access the "Inspect" and the "View source" tool through keyboard shortcuts. (As the answer at the top says, you can't stop it entirely.) But you can try to put barriers up to stop them.




                                                              share|improve this answer













                                                              Here's what I did:






                                                              function noRightClick() {
                                                              alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                              }

                                                                  <body oncontextmenu="noRightClick();">
                                                              <video>
                                                              <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                              </video>
                                                              </body>




                                                              This also works for images, text and pretty much anything. However, you can still access the "Inspect" and the "View source" tool through keyboard shortcuts. (As the answer at the top says, you can't stop it entirely.) But you can try to put barriers up to stop them.




                                                              function noRightClick() {
                                                              alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                              }

                                                                  <body oncontextmenu="noRightClick();">
                                                              <video>
                                                              <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                              </video>
                                                              </body>





                                                              function noRightClick() {
                                                              alert("You cannot save this video for copyright reasons. Sorry about that.");
                                                              }

                                                                  <body oncontextmenu="noRightClick();">
                                                              <video>
                                                              <source src="http://calumchilds.com/videos/big_buck_bunny.mp4" type="video/mp4">
                                                              </video>
                                                              </body>






                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered Mar 9 '18 at 16:37









                                                              Calum ChildsCalum Childs

                                                              109110




                                                              109110























                                                                  0














                                                                  We could make that not so easy by hiding context menu, like this:



                                                                  <video oncontextmenu="return false;"  controls>
                                                                  <source src="https://yoursite.com/yourvideo.mp4" >
                                                                  </video>





                                                                  share|improve this answer




























                                                                    0














                                                                    We could make that not so easy by hiding context menu, like this:



                                                                    <video oncontextmenu="return false;"  controls>
                                                                    <source src="https://yoursite.com/yourvideo.mp4" >
                                                                    </video>





                                                                    share|improve this answer


























                                                                      0












                                                                      0








                                                                      0







                                                                      We could make that not so easy by hiding context menu, like this:



                                                                      <video oncontextmenu="return false;"  controls>
                                                                      <source src="https://yoursite.com/yourvideo.mp4" >
                                                                      </video>





                                                                      share|improve this answer













                                                                      We could make that not so easy by hiding context menu, like this:



                                                                      <video oncontextmenu="return false;"  controls>
                                                                      <source src="https://yoursite.com/yourvideo.mp4" >
                                                                      </video>






                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Jan 4 at 12:09









                                                                      JcyrssJcyrss

                                                                      452415




                                                                      452415























                                                                          -1














                                                                          @Clayton-Graul had what I was looking for, except I needed the CoffeeScript version for a site using AngularJS. Just in case you need that too, here's what you put in the AngularJS controller in question:



                                                                              # This is how to we do JQuery ready() dom stuff
                                                                          $ ->
                                                                          # let's hide those annoying download video options.
                                                                          # of course anyone who knows how can still download
                                                                          # the video, but hey... more power to 'em.
                                                                          $('#my-video').bind 'contextmenu', ->
                                                                          false


                                                                          "strange things are afoot at the circle k" (it's true)






                                                                          share|improve this answer




























                                                                            -1














                                                                            @Clayton-Graul had what I was looking for, except I needed the CoffeeScript version for a site using AngularJS. Just in case you need that too, here's what you put in the AngularJS controller in question:



                                                                                # This is how to we do JQuery ready() dom stuff
                                                                            $ ->
                                                                            # let's hide those annoying download video options.
                                                                            # of course anyone who knows how can still download
                                                                            # the video, but hey... more power to 'em.
                                                                            $('#my-video').bind 'contextmenu', ->
                                                                            false


                                                                            "strange things are afoot at the circle k" (it's true)






                                                                            share|improve this answer


























                                                                              -1












                                                                              -1








                                                                              -1







                                                                              @Clayton-Graul had what I was looking for, except I needed the CoffeeScript version for a site using AngularJS. Just in case you need that too, here's what you put in the AngularJS controller in question:



                                                                                  # This is how to we do JQuery ready() dom stuff
                                                                              $ ->
                                                                              # let's hide those annoying download video options.
                                                                              # of course anyone who knows how can still download
                                                                              # the video, but hey... more power to 'em.
                                                                              $('#my-video').bind 'contextmenu', ->
                                                                              false


                                                                              "strange things are afoot at the circle k" (it's true)






                                                                              share|improve this answer













                                                                              @Clayton-Graul had what I was looking for, except I needed the CoffeeScript version for a site using AngularJS. Just in case you need that too, here's what you put in the AngularJS controller in question:



                                                                                  # This is how to we do JQuery ready() dom stuff
                                                                              $ ->
                                                                              # let's hide those annoying download video options.
                                                                              # of course anyone who knows how can still download
                                                                              # the video, but hey... more power to 'em.
                                                                              $('#my-video').bind 'contextmenu', ->
                                                                              false


                                                                              "strange things are afoot at the circle k" (it's true)







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Oct 4 '14 at 5:01









                                                                              Ryan CrewsRyan Crews

                                                                              2,50512325




                                                                              2,50512325

















                                                                                  protected by Tushar Gupta - curioustushar Oct 4 '14 at 6:54



                                                                                  Thank you for your interest in this question.
                                                                                  Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                                  Would you like to answer one of these unanswered questions instead?



                                                                                  Popular posts from this blog

                                                                                  Monofisismo

                                                                                  Angular Downloading a file using contenturl with Basic Authentication

                                                                                  Olmecas