Source language: Translate to:

Disable Right Click in a WebBrowser object

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Disable Right Click in a WebBrowser object

Postby Alex » Mon Jul 12, 2010 1:30 pm

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
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby smartmedia » Mon Jul 12, 2010 1:36 pm

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>
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Alex » Mon Jul 12, 2010 1:57 pm

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
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Neosoft Support » Tue Jul 13, 2010 10:47 am

You can disable the right click by turning off the "Context Menu" option in the Web Browser's properties.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Alex » Tue Jul 13, 2010 11:04 am

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
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest