-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
There is a requirement in our project to disable image download using right click 'Save Picture As' option on browser. Is it possible in ZK to disable by setting any property on AImage or zk.xml
Thanks in advance.
Gaurav
Here it is..
noRightClick.js
var message = "Sorry, right-click has been disabled";
function clickIE() {
if (document.all) {
(message);
return false;
}
}
function clickNS(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = clickNS;
} else {
document.onmouseup = clickNS;
document.oncontextmenu = clickIE;
}
document.oncontextmenu = new Function("return false");
Step-1: Add this noRightClick.js
file into your workspace under webContent folder.
Step-2: Which ever page you want to disable right Click write the following code after window tag.
<script src="/noRightClick.js"/>
Thus right Click is Disabled in that page.
Have Fun with ZK..
M Varun.
Asked: 2014-03-12 11:03:39 +0800
Seen: 21 times
Last updated: Mar 12 '14
Controller updating UI every minute
annotation porting from zk 3.6.2 to 6.5.3
How to customize "Processing..." message
JBoss AS 7.1 +Spring+ZK+DHtmlLayoutServlet
Portallayout, portalchildren ordering storage, possible bug
Sniffer Based Monitoring of ZK Apps
The server is temporarily out of service. (syntax error (SyntaxError))
One way is to disable rightclick, then we can avoid it... Conform me so that i can help you.
MVarun ( 2014-03-12 11:09:04 +0800 )editanother alternative is to set an empty popup to your component / overwrite the "right_click" listener, so the standard "save as" dialog is hidden.
IngoB ( 2014-03-12 11:13:26 +0800 )editThanks MVarun and IngoB. Can you please suggest any reference for disabling right click if it is possible.
gauravbhatt ( 2014-03-12 11:48:13 +0800 )edit