Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: How can I disable the "View source" menu in IE browser or Netscape browser?


Message #1 by xuejunca@y... on Wed, 7 Nov 2001 18:46:15

Hello,u can do the part of opening your window without the file menu,


     [newwindow = ][window.]open url, target, ["[toolbar=bool] [, location=bool][,
directories=bool][, status=bool][,
     menubar=bool][, scrollbars=bool][, resizeable=bool][, width=pixels][,
height=pixels]"][, top=pixels][, left=pixels]

then add this script to your page,




<script language="Javascript1.2">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var mymessage = "Sorry, but you can't view the source of this page.";

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
}

function rtclickcheck(keyp){

  if (document.layers && keyp.which != 1) {
    alert(mymessage);
    return false;
  }


  if (document.all && event.button != 1) {
    alert(mymessage);
    return false;
  }
}

document.onmousedown = rtclickcheck
//-->
</script>


  Return to Index