Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 27th, 2004, 11:49 PM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default prevent saving of images

Hello everybody,

Well i am developing an application in which few pages display just images ... (*.jpg) format ...

now what happens is that i dont want to allow the user to SAVE these images onto their disks ... when a user RIGHT CLICKS on the images menu pops us which gives option SAVE PICTURE AS ...

well so is there anyway i can prevent that ... i thought of following way ...

(1) If I can override the RIGHT CLICK event handler and replace it with my own custom code in which i may just display a Messagebox say ... "you cannot save this picture" ...but the problem is that i dont know how to override this event ...

i am using ASP with VBSCRIPT and i dont know anyother scripting language .... so plz help someone as soon as possible ...

any other method is WELCOME but keep it in VBSCRIPT ...

Sudhan.

__________________
--------------------------------------------------
Sudhan Kanitkar.
Everything Is In Our Hands.
Reply With Quote
  #2 (permalink)  
Old June 28th, 2004, 12:43 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Dear Sudhan,

I don't know any VB script which does this. But you can include this Javascript in the head tag. This will prevent thr menu appearing when any element on the page is clicked.

<script language="JavaScript1.1">
        function right(e)
        {
            if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
            else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
            {
                alert('This Page is fully protected!');
                return false;
            }
            return true;
        }
        document.onmousedown=right;
        if (document.layers) window.captureEvents(Event.MOUSEDOWN);
        window.onmousedown=right;
    </script>

----------------------------------------------------------------

I am including this in my pages. I got this from www.dynamicdrive.com some 3 years back.

But this is of little use in "REALLY" protecting your images. There are other methods to take away your image. Some of them are :

1) Save the page. REmove Javascript from head.

2) Disable Javascript and try.

3) View the source and get the full path to the image. Type that in the browser. right click the image and save.
You may prevent this by windows authentication on the images folder.

4) Just click "print screen". Go to paint. Paste the page. Cut only necessary portion. Make it to JPG image.

So, I am using an applet nowadays to prevent taking screen shots. (You can get a number of such applets from www.hotscripts.com). This will require JVM to be installed on browser.
Reply With Quote
  #3 (permalink)  
Old June 28th, 2004, 12:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Sudhan,

But for sure anyone can just disable the JavaScript, or look at the Source from View menu to get the image. Just for your satisfaction;), here it is.

-- If img is a link
Code:
<A HREF="javascript:void(0)" onMousedown="alert('Please! Do not download this image. Thanks!')"><IMG SRC="calendar.gif" Align="center" Border="0"></a>

OR

-- If img not a link
<IMG SRC="calendar.gif" Align="center" Border="0" onMousedown="alert('Please! Do not download this image. Thanks!')">
Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #4 (permalink)  
Old June 28th, 2004, 01:09 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Hi Madhu & Vijay,

That was great info on how people can have a look at the images .. really great ..

but i think for the time being i will apply the mention JAVASCRIPT security you people mentioned ... I am into ASP for just 3-4 weeks and i dont know JAVA or JAVASCRIPT ... so going for more complex protections seems out of question for the time being when i have just another week to finish my work ...

but i have just one more question ... for the above solutions .. does the browser needs to have JAVA enabled....

Sudhan.

Reply With Quote
  #5 (permalink)  
Old June 28th, 2004, 01:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think it should be called JAVASCRIPT enabled for this to work fine, and not JAVA enabled. May be you are referring to that?

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #6 (permalink)  
Old June 28th, 2004, 01:54 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Yep Vijay,

should the browser be JAVASCRIPT enabled ..??

Sudhan.

Reply With Quote
  #7 (permalink)  
Old June 28th, 2004, 02:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

100% Yes...:)

_________________________
-Vijay G
Strive for Perfection
Reply With Quote
  #8 (permalink)  
Old June 29th, 2004, 12:05 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Hello Folks,

Time to help again !!!

AS suggested by Vijay i used the following

---------------------------
<IMG SRC="calendar.gif" Align="center" Border="0" onMousedown="alert('Please! Do not download this image. Thanks!')">
-----------------------------

Now what this thing does is that it displays a dialog saying "Plz DO ..." ...
What should i do if i want that NOTHING should happen when a User right clicks on IMAGE ..absolutely nothing should happen ...

Is It POSSIBLE ?????

Another thing ... When the MOUSE moves over the image a FLOATING TOOLBOX kind of thing appears which has
buttons likes SAVE,PRINT,EMAIL and things like that ... so what should i do so that NOTHING happens when
the mouse moves over the IMAGE ...

PLZ PLZ help ...

Sudhan.


Reply With Quote
  #9 (permalink)  
Old June 29th, 2004, 12:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Sudhan,

Quote:
quote:Now what this thing does is that it displays a dialog saying "Plz DO ..." ...
What should i do if i want that NOTHING should happen when a User right clicks on IMAGE ..absolutely nothing should happen ...

Is It POSSIBLE ?????
Only since you override the right click event with an alert, you are not displayed the Shortcut menu that lets the user save the image, but removing that would show you the shortcut menu for sure. I think we have to spend time and find a work around for that.

Quote:
quote:SAVE,PRINT,EMAIL and things like that ...
This is browser's default behaviour, for changing this one would have to take much effort.;) something like writing our own browsers.

Can give it a shot, but as said earlier, there are several means by which one can save the image from the browser, so one cannot go restricting all that one by one, then one would end up with his own browser.

Lets find if that can be done. IMO don't put much effort on this.;)

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #10 (permalink)  
Old June 29th, 2004, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Sudhan,

This is not to discourage you. But worth having a look at it. If you are interested, please go through

Don't Disable Right Click!

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent user logon and password from saving Hughesie78 ASP.NET 2.0 Basics 1 December 6th, 2007 12:20 PM
saving images that are displayed on applets Kiran Kumar Java Basics 0 April 5th, 2006 01:21 AM
Saving images Sudoku Visual Basic 2005 Basics 0 March 24th, 2006 11:44 AM
Saving,printing and editng images through vb.net Paru General .NET 2 April 2nd, 2005 12:12 PM
saving images and shapes together saiyedriyaz BOOK: Beginning Java 2 1 June 12th, 2004 08:23 AM



All times are GMT -4. The time now is 05:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.