SuperSonic2K3
New member
Uhh...can someone tell me how to disable the right mouse button on HTML pages?
<script language="JavaScript1.2">
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;
}
}
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
</script>
They can still get access to your raw HTML though. I don't see the big deal anyway, HTML is so easy any monkey can do it. Even the "advanced" stuff is not worth trying to protect. Some Javascript code might be worth the effort, but there are ways to go about that that don't involve disabling browser features.RAGE LT MAN said:they can steal your code by viewing source from the toolbar, as rathched so markedly pointed out. even if you prevent that somehow, as long as the page is on their system, they can access the code. Only way to keep people from seing code is to have the server compile it (say PHP or some other script) and output HTML, this way the ingenious code you actually made isn't seen by the user.
You can set the window.status to something for the links onmouseover event, that would hide the link showing up in the status bar. That certainly wouldn't stop people from copying the shortcut to their clipboard though.SuperSonic2K3 said:The other thing I want to do is to hide links from the site so that people don't steal them, but the URL can show up at the bottom of the browser...anyone know how to shield it?
<a href="somesecretlink.htm" onmouseover="window.status='some text';return true;" onmouseout="window.status='';return true;">link</a>
Yep, the best way to prevent someone from leeching from you is to use an anti-leech script.RAGE LT MAN said:links can always be stolen, they just open the page, see the URL in the address bar, and they're set.
<script language="JavaScript1.2">
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
Y-STU-K said:i have an idea why don't u just disable all functions in the browers apart from clicking links, scrolling and exiting the page :P that would fix it altho why would someone wanna steal HTML code. My mum can write HTML so why does it matter