Såhär kan man skydda sin sida mot högerklick, med de klassiska medlen kan man ju med hjälp av att hålla in musknappen, klicka på mellanslag och släppa upp musknappen, lätt slinka förbi sådana här skydd(som många ändå använder...):
[KOD]
<script language="javascript">
<!--
function opennew(link){
window.open(link);
return 1;
}
function click() {
if (event.button==2) {
alert('Copyright © 2003 Arne Anka');
}
}
document.onmousedown=click
// -->
</script>
[/KOD]
Nu till den riktiga koden.. såhär skyddar du enkelt din sida med själp av "norightklick v1.0"
[KOD]
<html>
<script language="JavaScript1.2">
if (window.Event) // Only Netscape will have the CAPITAL E.
document.captureEvents(Event.MOUSEUP); // catch the mouse up event
function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true;
event.returnValue = false;
return false;
}
function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
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; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
[/KOD]
MVH BromZ
[KOD]
<script language="javascript">
<!--
function opennew(link){
window.open(link);
return 1;
}
function click() {
if (event.button==2) {
alert('Copyright © 2003 Arne Anka');
}
}
document.onmousedown=click
// -->
</script>
[/KOD]
Nu till den riktiga koden.. såhär skyddar du enkelt din sida med själp av "norightklick v1.0"

[KOD]
<html>
<script language="JavaScript1.2">
if (window.Event) // Only Netscape will have the CAPITAL E.
document.captureEvents(Event.MOUSEUP); // catch the mouse up event
function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true;
event.returnValue = false;
return false;
}
function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
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; // for IE5+
document.onmousedown = norightclick; // for all others
</script>
[/KOD]
MVH BromZ


Kommentera