View Full Version : Disable Menubar


littlegirl
06-20-2003, 03:53 PM
Um, I want to ask. Can we disable the menubar? So, people can't source the code. If we can, how to disable it?
Thanks.

SSPrincess
06-20-2003, 04:01 PM
I think you mean right click. Anyway, here's the code I use:
<script language="JavaScript1.2">
//original author unknown
//modified by, and displayed on www.a1javascripts.com
if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;
//-->
</script>


I hope this is what you wanted!

littlegirl
06-20-2003, 04:24 PM
No, no right click.
I don't want people can source the code. So, they can't copy. Can we?

Dude128
06-20-2003, 06:04 PM
no, there really is no way to prevent people from getting your code. you could open your main page in a popup, since I believe you can turn off the menu bar in them. but on your first page, people can still view the source, get the URL of your main page, open that in a regular browser window, and view source. if you put the no right click code (which personally I think is annoying) on the page in the popup, it might prevent beginners from getting the code, though.

littlegirl
06-21-2003, 03:35 AM
Oh...
Okay... hope she doesn't copy my site!!

Thanks SSPrincess and Dude 128.

designhazard
06-21-2003, 05:22 AM
but you can encrypt the code! just copy and paste your source code into the box and replace it with your old code. here's the page: http://www.dynamicdrive.com/dynamicindex9/encrypter.htm. do decrypt the code, go to http://www.ozzu.com/descramble/descramble.cgi.

Dude128
06-21-2003, 07:16 PM
but keep in mind that if you can decrypt it, so can anyone else. there really is no way to protect your code 100%. the way I look at it, if someone copies your site, you can e-mail them and ask them to take it down. if they can look at your source and without copying it, learn something from it, then it's not a big deal.