General discussion

Locked

Notification of attempted download...

By keeferboy ·
I read about and have since lost the HTML or Java code that lets you know when someone has right-clicked an image on a webpage. The code pops a window to the user stating whatever you want to the viewer. You can't prevent the download, but can at least notify them that you caught it. I'd like to have the code to do this and I believe it was fairly simple. Thanks.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Notification of attempted download...

by eBob In reply to Notification of attempted ...

There is no HTML to do this.

Javascript usually depends on the document object model in use by the client browser, and I have not seen an "onRightClick()" method, unless it's in one of the new v6 browsers.

Which leaves JAVA, which I would think depends on the client successfully downloading a JAVA applet. Not something to be guaranteed, I suspect.

Collapse -

Notification of attempted download...

by keeferboy In reply to Notification of attempted ...

Poster rated this answer

Collapse -

Notification of attempted download...

by chrandrob In reply to Notification of attempted ...

You'll need to change the message variable to what you want to display. This only works in Internet Explorer 5.0 or later:

<script language="JavaScript">

var message = "Sorry, that function is disabled.\n\n";
message += "This page is copyrighted, and ";
message += "all content is protected.";

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}

if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
</script>

Collapse -

Notification of attempted download...

by keeferboy In reply to Notification of attempted ...

Poster rated this answer

Collapse -

Notification of attempted download...

by keeferboy In reply to Notification of attempted ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums