2

Suppose there is a html page containing some images.

we want to disable the downloading of the images from user side.

Is that possible?

Should I need to use any javascript or add some attributes in <img> tag?

My current code is

       <td><img src="images/handmade (1).jpg" class="img-responsive" alt="" /></td>

    </tr>
  </table>

Is there any technique to prevent image from downloading?

serenesat
  • 4,611
  • 10
  • 37
  • 53
tinku
  • 331
  • 4
  • 14
  • 1
    It is not possible to prevent user from downloading image. User can download image anyway. – ketan May 22 '15 at 09:09

3 Answers3

4

No, it cannot be done. Explanation here: https://graphicdesign.stackexchange.com/a/39464/24086

For all intents and purposes, this is downright impossible. You can disable right click, but people can still view the source code of your page (by adding view-source: to the URL in Chrome, or just using a browser menu) and find the URL. You can use a CSS background-image instead of HTML , but people can still use their browser's inspector (F12 for most browsers) and find that element's CSS properties. You can engineer some crazy thing that you think will work, but at the end of the day, the user has to download the image in some way to see it. If the user is completely unable to download the image, he/she won't even be able to see it in the first place! No matter what you do, nothing will prevent a simple glance at a network traffic monitor or the "Network" tab of your favorite browser's developer tools.

Community
  • 1
  • 1
K K
  • 17,794
  • 4
  • 30
  • 39
1

Depends what you mean by downloading, really.

The user has to be able to download the image (i.e. retrieve the image onto their computer) in order to display the image in their browser. I suspect what you mean is that you want to stop them saving that specific image onto their computer. Any attempt to try and stop them doing this is pretty pointless, as they can always take a screenshot, or just access the image directly using the URL.

I've seen various attempts using javascript to try and stop users from saving images, but they are all easily worked around.

TobyLL
  • 2,098
  • 2
  • 17
  • 23
  • is there any way to stop right click on image using javascript. i think this can stop downloading. – tinku May 22 '15 at 09:30
  • It won't. Users will simply disable javascript in their browser, or retrieve the image directly. – TobyLL May 22 '15 at 09:32
  • you are right ! but at least it will stop downloading from the user who dont know how to disable javascript from their browser – tinku May 22 '15 at 09:38
  • @user3497153 user can use developer tool like firebug to download the image also. – ketan May 22 '15 at 09:44
  • i think this is possible by applying some scripting that prevent right clicking on page and if user disable javascript engine from developer tool then we can hide our whole page content using the code > noscript executes when javascript is disabled from client side same approach is used by facebook. – tinku May 22 '15 at 10:42
0

Cut up the image server-side and store them that way, then assemble them as one image in javascript client-side. The user could download each segment via URL and assemble them manually, but that is much more work than most users are willing to do.

Glubbdrubb
  • 357
  • 1
  • 2
  • 13