Question

7
Replies
145
Views
SureshO6 Member since 2018 12 posts
Evonsys
Posted: 1 year ago
Last activity: 1 year 9 months ago
Closed

Disable Right Click option on Image

When an image is displayed from other link by using Iframe, the requirement is user not allowed to download or save or copy image by right click option

I am using the code to display (working fine) and disable right click option(not working) as below

Fragment and direct code copy used but not working.

<pega:include name="TestRightClickDisable" type="RULE-HTML-FRAGMENT"></pega:include>
<script>
function clickIE() {
if (document.all) {
return false;
}
}
function clickNS(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which == 2 || e.which == 3) {
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")
</script>
<head> <title>HTML Iframes</title> </head>
<body oncontextmenu="return false;">
<iframe src = "<pega:reference name=".DocumentLink" mode="normal"/>" width = "1000" height = "300"> </iframe>
</body>
Can you please help me to make it work.
***Edited by Moderator Marissa to update platform capability tags****
User Interface
Moderation Team has archived post
Share this page LinkedIn