Hot answers tagged


You can't prevent it, you can only stop people who don't understand coding. Generally it is done with Javascript which is easy to disable. Further, it is a trivial matter to take a screenshot of an image. If you are actually talking about hot linking (displaying images from your server on another site) that can be done via .htaccess.


By definition, if a visitor can view an image, it has already been downloaded. That's how a web page works. You can however use a variety of tactics to make it more difficult to do so. As you've mentioned, using JavaScript to interfere with the normal contextual menu is an option. However, that won't work if the user has disabled JavaScript on their browser. ...


One more trick to make it a little harder, which also works with Javascript disabled. Use CSS to position a transparent element over the image, so that right clicking it does not show the image-related options. Or, for added confusion, overlay a transparent image on top, so that right clicking downloads the wrong image. Example:


For mitigating direct URL access you would have to implement a token system which allows images to be downloaded only when the page is visited. When the web page loads, generate a token and save it to a database with a timestamp, for every image on your page append the token like so image.jpg?token={whatever}, set images to be handled by a script, have this ...


To simply disable the Context (right-click menu) at the web page level: HTML body tag: <body oncontextmenu="return false"> Javascript on page: document.oncontextmenu = function() { return false; } (Reference: recommended site --


Using the CSS rule pointer-events: none; on image elements prevents them from responding to click events: right clicking the image will still show a page context menu, but without "save image" or "copy image location" options. As understood, pointer-events: none won't stop downloading images using standard browser tools (such as "...


Embed the images in a multimedia object. Back before Flash got rendered obsolete and had its support removed, one popular method for doing this was embedding the images you want to display (but prevent the user from downloading) into a Flash file, preventing the users from accessing the images directly. While Flash is unfortunately no longer an option (for ...


The way you're probably looking for is a javascript script overriding the call for a context-menu on <img> tag that does not call the menu and does not do anything. The exact script depends on technologies used on your site, the most common way is pure javascript (and also the only way independent on the technologies on your site), others might be ...

Only top voted, non community-wiki answers of a minimum length are eligible