Page 1 of 1

Disable Right Click in a WebBrowser object

PostPosted: Mon Jul 12, 2010 1:30 pm
by Alex
Hi,

Is it possible to disable the Right Click in a Webbrowser object? I tried:
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!-- Disable
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")
document.oncontextmenu=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
//-->
</script>


But it doesn't work. Is there an other solution?

Thanks


Alex

PostPosted: Mon Jul 12, 2010 1:36 pm
by smartmedia
Hi..

Try that.
Code: Select all
<script language="JavaScript1.1">
// distributed by http://www,hypergurl.com <!-- var debug = true; 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>

PostPosted: Mon Jul 12, 2010 1:57 pm
by Alex
Hi SmartMedia,

Thanks but I always got the error box: 80020101

Here is my code:

Code: Select all
BrowserExecScript "WebBrowser1" "<script language=[#34]JavaScript1.1[#34]>|// distributed by http://www,hypergurl.com|<!-- var debug = true; 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>" "JScript"


Thanks


Alex

PostPosted: Tue Jul 13, 2010 10:47 am
by Neosoft Support
You can disable the right click by turning off the "Context Menu" option in the Web Browser's properties.

PostPosted: Tue Jul 13, 2010 11:04 am
by Alex
Hi,

Thank you for your answer.

I didn't know that Context Menu means disable right click. Well, I am happy to know it.

Thanks


Alex