We help IT Professionals succeed at work.

Stop people viewing source

dj00
dj00 asked
on
How do I stop people viewing my source and getting my code?  I don't want my competitor to view is the problem.  Thanks
Comment
Watch Question

Commented:
You don't. You're using FrontPage, right? You didn't write the code anyway -- the program did. Anything you did anybody with FrontPage can do.

Commented:
However, you CAN custom code scripts into FP, so not all code is automatically generated.  So it depends on what "code" you are talking about.  Have you written any custom code?
What exactly is it you are trying to "HIDE" dj00?  If it is just HTML, I can see it no matter what you do.  Disabling right-click won't work....nor will disabling the view source.

Try this....go to any site where you think the source code is hidden and type this in the address bar:

javascript:str=document.documentElement.innerHTML;document.write('<textarea rows=20 cols=60>'+str+'</textarea>');

IF you are trying just to make it difficult, let me know....that we can do.  Trying to make it impossible, IS IMPOSSIBLE.

Author

Commented:
I really am not trying to hide anything.  I just don't want the to right click and copy.  I have seen that happen when I try to view source.  I haven't written any custome script.  However, I would like to prevent people from looking.  Sounds wierd but just want to stop a competitor that I know is copy my website.  At least he will have to type it then.

Don

Commented:
You want to know how to REALLY protect it? Put a copyright notice on the page, put all the javascript in an external file, and put copyright notices as comments in both the javascript and the HTML. (And if you don't know how...you've got nothing to copyright other than content)

They'll have to grab the external javascript. They'll have to grab the HTML. And you'll have half a legal leg to stand on...
You ARE planning to sue, right? ;-)
Do disable the right-click...if that is all you want to do use this:

http://web-wise-wizard.com/javascript-tutorials/disable-right-click.html
dj00.....how's it going?

Author

Commented:
I am working on it now.  Will post tomorrow.  Thanks
Don
ok...we'll be waiting.
How did it go dj???
Commented:
Hi Pal ! Let me show u something why dont u try that :P

copy the below code and save that as ScriptEncryptor.html in to ur hard disk. This is a small application where ur Html Code (the code that u have written)is pasted in to the text area, and  then click the Encrypt Button. Then the Application will take 2 secs to rewrite ur COde in to some format what even u cant understand it will look something like this

<script>
<!--
document.write(unescape("%3Dbutton%20value%3DTest%20name%3Dview%20onClick%3Dpreview%28%29%20onMouseOver%3DLightOn%28this%29%20%0D%0A%0D%0AonMouseOut%3DLightOut%28this%29%20style%3D%22border-left%3A%201px%20solid%20%23990000%3B%20border-right%3A%201px%-->
</script>

... So take the Encrypted code and save it asit is to the former code what u have created. It will work absolutely fine when anyone sees the source they will find it like the above thing . that Confuses even u. So i Guess ur problem is solved .Though u cant prevent anyone frm seein the code u can always do this to Confuse him.

Save this as ScriptEncrypter.html
------------------------------------------------
<html>
</head>
<noscript>
<BODY><CENTER><script language="JavaScript">
<!--
// Cache-busting LUBID bug.
var ran = Math.round(Math.random() * 899999) + 100000;
var lubid_string = "<img src=\"http://lubid.lycos.com/one.asp?site=members.tripod.lycos.com&ord="

+ ran + "\" height=\"1\" width=\"1\">";
document.write(lubid_string);
//-->
</script>
<center><table border="0" cellpadding="0" cellspacing="0" align="center">
      <tr>
            <td><A HREF="http://www.tripod.lycos.com"><IMG SRC="/adm/img/popup/tripodsm.gif"

ALT="hosted by tripod" WIDTH="116" HEIGHT="26" BORDER="0" VSPACE="2"></A></td>
      </tr><tr>
            <td align="center" valign="top" width="468"><IFRAME

SRC="http://ln.doubleclick.net/adi/tr.ln/member;h=misc;sz=468x60;ord=23222094017318?" width=468

height=60 frameborder=0 border=0 marginheight=0 marginwidth=0 vspace=0

scrolling=no></IFRAME></td>
      </tr>
</table><table border="0" cellpadding="0" cellspacing="3" align="center" width="468">
      <tr>
      <td><font size="1" face="verdana, arial, helvetica, sans serif"><a

href="/bin/email_this_page/display_form">E-mail this page to a friend</a></font></td>
      <td align="right"><font size="1" face="verdana, arial, helvetica, sans serif"><a

href="/bin/email_when_updated/display_form">Tell me when this page is updated</a></font></td>
      </tr>
</table></center>
</CENTER>



</noscript>
<title>Jayanth Sharma --Source Code Encrypter</title>
<STYLE>
. {scrollbar-3d-light-color: #FFFF00;
scrollbar-arrow-color: red;
scrollbar-base-color: #00FF00;
scrollbar-dark-shadow-color: #808080;
scrollbar-face-color: #000000;
scrollbar-highlight-color: #006600;
scrollbar-shadow-color: #00FF00}
</STYLE>
</head>


<script language=JavaScript>
<!--
var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;

function initStyleElements() /* Styles for Buttons Init */
{
var c = document.pad;
if (ie)
{
//c.text.style.backgroundColor="#DDDDDD";
c.compileIt.style.backgroundColor="#00CC00";
c.compileIt.style.cursor="hand";
c.select.style.backgroundColor="#00CC00";
c.select.style.cursor="hand";
c.view.style.backgroundColor="#00CC00";
c.view.style.cursor="hand";
c.retur.style.backgroundColor="#00CC00";
c.retur.style.cursor="hand";
c.clear.style.backgroundColor="#00CC00";
c.clear.style.cursor="hand";
}
else return;
}

/* Buttons Enlightment of "Compilation" panel */
function LightOn(what)
{
if (ie) what.style.backgroundColor = '#00FF00';
else return;
}
function FocusOn(what)
{
if (ie) what.style.backgroundColor = '#EBEBEB';
else return;
}
function LightOut(what)
{
if (ie) what.style.backgroundColor = '#00CC00';
else return;
}
function FocusOff(what)
{
if (ie) what.style.backgroundColor = '#DDDDDD';
else return;
}
/* Buttons Enlightment of "Compilation" panel */

function generate() /* Generation of "Compilation" */
{
code = document.pad.text.value;
if (code)
{
document.pad.text.value='Compiling...Please wait!';
setTimeout("compile()",1000);
}
else alert('First enter something to compile and then press Encrypt')
}
function compile() /* The "Compilation" */
{
document.pad.text.value='';
compilation=escape(code);
document.pad.text.value="<script>\n<!--\ndocument.write(unescape(\""+compilation+"\"));\n//-->\n<

\/script>";
i++;
if (i=1) alert("Page compiled 1 time!");
else alert("Page compiled "+i+" times!");
}
function selectCode() /* Selecting "Compilation" for Copying */
{
if(document.pad.text.value.length>0)
{
document.pad.text.focus();
document.pad.text.select();
}
else alert('Nothing to be selected!')
}
function preview() /* Preview for the "Compilation" */
{
if(document.pad.text.value.length>0)
{
pr=window.open("","Preview","scrollbars=1,menubar=1,status=1,width=640,height=320,left=20,top=50"

);
pr.document.write(document.pad.text.value);
}
else alert('Nothing for be previewed!')
}
function uncompile() /* Decompiling a "Compilation" */
{
if (document.pad.text.value.length>0)
{
source=unescape(document.pad.text.value);
document.pad.text.value=""+source+"";
}
else alert('You need compiled code to uncompile it!')
}
// -->
</script>
<body bgcolor=#000000 text=#00FF00 topmargin=0 leftmargin=0 marginheight=0 marginwidth=0

onload=initStyleElements()>
<script language="JavaScript1.2">
if (document.all)
document.body.style.cssText="border:10 ridge #009900"
</script>

<table border=0 width=100% cellspacing=0 cellpadding=0 align=center>
<tr>
<td width=100% height="23"></td>
</tr>
<tr>
<td width=100% height=23></td>
</tr>
<tr>
<td width=100% align=center>
<center><h2>Jayanth's Source Code Encrypter</h2></center>
<!-- Compilation Panel -->
<form method=post name=pad align=center>
<textarea rows=11 name=text cols=58

style="background-color:#CAFFCA;width:95%"></textarea><br><br>
<input type=button value=Encrypt name=compileIt onClick=generate() onMouseOver=LightOn(this)

onMouseOut=LightOut(this) style="border-left: 1px solid #990000; border-right: 1px solid #990000;

border-top: 1px solid #990000; border-bottom: 1px solid #990000">&nbsp;
<input type=button value=Select name=select onClick=selectCode() onMouseOver=LightOn(this)

onMouseOut=LightOut(this) style="border-left: 1px solid #990000; border-right: 1px solid #990000;

border-top: 1px solid #990000; border-bottom: 1px solid #990000">&nbsp;
<input type=button value=Test name=view onClick=preview() onMouseOver=LightOn(this)

onMouseOut=LightOut(this) style="border-left: 1px solid #990000; border-right: 1px solid #990000;

border-top: 1px solid #990000; border-bottom: 1px solid #990000">&nbsp;
<input type=button value=Source name=retur onClick=uncompile() onMouseOver=LightOn(this)

onMouseOut=LightOut(this) style="border-left: 1px solid #990000; border-right: 1px solid #990000;

border-top: 1px solid #990000; border-bottom: 1px solid #990000">&nbsp;
<input type=reset value=Clear name=clear onMouseOver=LightOn(this) onMouseOut=LightOut(this)

style="border-left: 1px solid #990000; border-right: 1px solid #990000; border-top: 1px solid

#990000; border-bottom: 1px solid #990000">
</form>
<!-- Compilation Panel -->

</td>
</tr>
</table>
<blockquote>
Paste the source code of your page into the text area.  Click the <b>Encrypt</B> button to

encrypt the source code.
<p>
<b>Select</B><br>Highlights the encrypted code so that it may be copied.
<p>
<b>Test</B><br>
Opens the encrypted code in a new browser window.
<p>
<b>Source</B><br>Un-encrypts the source code.
<p>
<b>Clear</B><br>Clears the text area.
</Blockquote>
<br><br>
</BODY>
</html>
-------------


Now Follow the Instructions as i have said above !! plz read it patiently - I dont think it will confuse u.

All the best :)and ADios

Jayanth Sharma

Commented:
SUppose u have to get back the COde again COpy the same Encrypted code to the same Encrypter and press deencrypt! ur Html Code is Back. U can Encrypt the code as many times as u want. But Remember to get back the code u have to de encrypt the code the same no of times u have Encrypted.

Hope u Understand. Waiting for ur results.

JAyanth Sharma

Commented:

Author

Commented:
Can I give credit to two people?  I want to give 200 points to Jayyu2k's and Classylinks.  How do I do that?
dj...what you do is accept one comment as an answer here and create another question for the other person...call it Points for "whoever" and you MUST reference this question # in the new question so that community support knows it is legit.

8-)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.