View Full Version : "view source"
jpcorzo
05-10-2003, 05:43 PM
I'm new in java and i just want to know how can I block the "view source" for one of my websites. i would appreciate if you give the codes. thnks
Thanks in advance
scroots
05-10-2003, 05:59 PM
firstly its javascript not java, there is a difference.
You cannot disable the view source but you can encrypt it and do other stuff and the end result is that it just takes a bit longer to find out the source code.
scroots
tlyall
05-13-2003, 07:17 PM
You can try and block access by using a no right click script that can be found at DD, but it won't do any good if someone wants to look at your code.
<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
There are several ways to view the source code of an on-line document. and the no right click script does block the right click but does not prevent the viewer from looking at the code.
Just my 2 cents...
Tom
brothercake
05-13-2003, 08:41 PM
Please see this thread (http://www.codingforums.com/showthread.php?s=&threadid=4437) for further discussion
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.