Question

7
Replies
213
Views
Close popover
Suresh Oruganti (SureshO6)
Evonsys

Evonsys
IN
SureshO6 Member since 2018 12 posts
Evonsys
Posted: November 26, 2018
Last activity: November 28, 2018
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 Experience
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.