Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Is it possible to put following restrictions on website pages;
1)On right clicking the image, option of save as image should not be there.
2)If somebody save the page by save as from browser,images should not be saved on user machine.
Posted

You can not do that with pure html/http - since if it has an url, any http client can fetch it, not only a browser. But one can also disable javascript, intercept http traffic and so on.
The only option (not totally secure trough) is to use a custom browser plugin or applet (silverlight, javafx, flex, flash or whatever), that implements a viewer for a custom (encrypted, scrambled) image container. This one could fetch the properly prepared/generated image data from the server and present it. But as it will contain all logic and will run on client side, will be exposed to reverse engineering for example. And you can not prevent somebody capturing the screen.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 21-Sep-12 15:26pm    
First part is correct; but all tricks on the client-side are useless. (I voted 4 though.)
Whatever tricks you can do on a client side... no, you don't know what browser is used; and they cannot be compatible in this dirty stuff, because there are no standard about it.

The basic fact is that the serve delivers a picture to a client side anyway. Any developer can act as a client side and store it. I explained it in my answer -- please see.
--SA
Zoltán Zörgő 21-Sep-12 15:40pm    
You misunderstood my suggestion. I suggested serving an encrypted/scrambled image, not a normal one. Simply fetching the image data won't be enough to view it. But as I stated, reverse engineering the client side plugin/applet would reveal the logic.
I suggested no dirty stuff, regular embedded object or plugin - but I have to agree, there is a compatibility problem. Still, if there is a need of such protection, a required browser compatibility (like having a desire flash version installed) could be acceptable.
But yes, in general it is useless trying such thing, - but in special cases might worth the effort.
Sergey Alexandrovich Kryukov 21-Sep-12 16:10pm    
Yes, I misunderstood it a bit. Yes, it will work, but then it won't be shown using a "regular" Web browser, and I would say still there is a change for unscrambling. And you mentioned by yourself that capturing the screen will still be possible. Anyway, I'm going to up-vote you post to maximum; first, not understanding your idea was my fault, secondly -- for inventiveness... :-)
--SA
Zoltán Zörgő 21-Sep-12 16:17pm    
Thank you.
There is no way. You will understand it yourself, if you get yourself some time to learn how Web works. This is a pure client-server; and everything is done by the HTTP server in response to HTTP requests. At the moment a user can see some picture, it's already on the client side. The user right-clicks to get a context menu, select "Save Image As"; and it's done. Even if you try some dirty client-side tricks like disabling some UI features, it could be a hassle only for a complete moron. Forget it.

—SA
 
Share this answer
 
v2

C#
$('img').bind('contextmenu', function(e){
    return false;
});

This will disable right-mouse button click on any image.
 
Share this answer
 
Comments
Zoltán Zörgő 21-Sep-12 15:27pm    
Until somebody disables Javascript.
Sergey Alexandrovich Kryukov 21-Sep-12 16:22pm    
Exactly. I would download this image without any browser in no time.

By the way, a question to ShotDriller: do you mean that this "g" image goes on this page comes with disabled context menu? I can see both context menu and "Save Image As" in my browser.

--SA
Go through the discussion in Restrict the user to copy or save the images in the online[^].

They have discussed exactly what you need.
Check all posts and the last post which is the accepted answer.

Thanks...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900