No se puede proteger al 100% el codigo fuente
del HTML podrias usar algun encriptador, pero, si ese "alguien" tiene un desencriptador ya re imaginaras que sucede
pues, no sé, te recomiendo que pruebes el encriptador
por ahí en la red hay muchos
Te pongo unos
Código :
<html>
<head>
<title>Source Code Encrypter</title>
</head>
<body bgcolor="#c0c0c0" style="font-family:arial,helvetica" leftmargin="0" marginwidth="0" onload=initStyleElements()>
<center><b style="background-color:#ffff00"> YOU GOT THIS BASIC ENCRYPTION PROGRAM AT <a href="http://www.folk7.com">FOLK7.COM</a> </b><br><br>
<b>But the full credit goes to:<br>Svetlin Staev, [email protected]<br><br>
Script submitted/featured on <a href="http://www.dynamicdrive.com">Dynamicdrive.com</a></b>
<br>
<script language=JavaScript>
<!--
////////////////////////////////////////////////////////////
// Source Code Encrypter v1.0 //
///////////////////////////////////////////////////////////
// //
// This JavaScript can be freely used as long as this message //
// stays here in the header of the script. Any modifications //
// and bugs found (and fixed) are appreciated. //
// Script submitted/featured on Dynamicdrive.com //
// Visit http://www.dynamicdrive.com for source code //
// Svetlin Staev, [email protected] //
////////////////////////////////////////////////////////
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="#FFFF00";
c.compileIt.style.cursor="hand";
c.select.style.backgroundColor="#FFFF00";
c.select.style.cursor="hand";
c.view.style.backgroundColor="#FFFF00";
c.view.style.cursor="hand";
c.retur.style.backgroundColor="#FFFF00";
c.retur.style.cursor="hand";
c.clear.style.backgroundColor="#FFFF00";
c.clear.style.cursor="hand";
}
else return;
}
/* Buttons Enlightment of "Compilation" panel */
function LightOn(what)
{
if (ie) what.style.backgroundColor = '#00FFFF';
else return;
}
function FocusOn(what)
{
if (ie) what.style.backgroundColor = '#EBEBEB';
else return;
}
function LightOut(what)
{
if (ie) what.style.backgroundColor = '#FFFF00';
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()",10);
}
else alert('First enter something to compile and then press CompileIt')
}
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 for 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=700,height=320,left=50,top=110");
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>
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr>
<td width=100%>
<!-- Compilation Panel -->
<center><form method=post name=pad align=center>
<textarea rows=11 name=text cols=58 style="background-color:#EBEBEB;width:95%"></textarea><br>
<input type=button value=Encrypt name=compileIt onClick=generate() onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
<input type=button value=Select name=select onClick=selectCode() onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
<input type=button value=Preview name=view onClick=preview() onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
<input type=button value=Source name=retur onClick=uncompile() onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
<input type=reset value=Clear name=clear onMouseOver=LightOn(this) onMouseOut=LightOut(this)>
</form>
<!-- Compilation Panel -->
</td>
</tr>
</table>
</body>
</html>
Y, este es otro
Código :
<html>
<head>
<!-- PRIMER PASO: Copiar dentro del tag HEAD -->
<script language="JavaScript">
<!--
// -- iniciamos la variable del número de veces encriptada
var as=0;
// -- creamos la función para la Encriptación
function codificar()
{
codigo = document.form.texto.value;
if (codigo)
{
document.form.texto.value='Encriptando.... un momento por favor!'; // -- Mensaje en la caja de texto
setTimeout("compilar()",1500); // -- Tiempo que muestra el mensaje 1,5 segundos
}
// -- Pulsamos Encriptar con la caja de texto vacia
else alert('Antes de pulsar Encriptar debes escribir el código HTML') // -- Mensaje de aviso de caja vacia
}
// -- Creamos la función que escribe el código en la caja de texto
function compilar()
{
document.form.texto.value='';
compilado=escape(codigo);
document.form.texto.value="<script>\n
<!--\ndocument.write(unescape(\""+compilado+"\"));\n//-->\n
<\/script>";
// -- Averiguamos el número de veces que ha sido encriptada
as++;
if (as=1) alert("Página encriptada!"); // -- Si es la primera encriptación
else alert("Página encriptada "+as+" veces!"); // -- Si se ha encriptado más de una vez
}
// -- Creamos la función de selección del texto en la caja
function seleccionar()
{
if(document.form.texto.value.length>0)
{
document.form.texto.focus();
document.form.texto.select();
}
else alert('No hay nada para seleccionar') // -- Mensaje si la caja de texto esta vacia
}
// -- Creamos la función de previsualización en una ventana nueva
function previsualizar()
{
if(document.form.texto.value.length>0)
{
previo=window.open("","Previsualizar","scrollbars=1,menubar=1,
status=1,width=640,height=320,left=100,top=100"); // -- Crea la ventana, las medidas son editables
previo.document.write(document.form.texto.value);
}
else alert('No hay nada para previsualizar') // -- Mensaje si la caja de texto no contiene ningun código
}
// -- Creamos la función para desencriptar el código
function decompilar()
{
if (document.form.texto.value.length>0)
{
decompilado=unescape(document.form.texto.value);
document.form.texto.value=""+decompilado+"";
}
else alert('No hay nada para desencriptar') // -- Mensaje si la caja de texto no contiene ningun código
}
// Final del script
// -->
</script>
</head>
<body>
<!-- SEGUNDO PASO: Copiar dentro del tag BODY -->
<form method="post" name="form" align="center">
<div align="center">
<textarea rows="10" name="texto" cols="60"></textarea name="texto"><br> <!-- Caja de texto -->
<br>
<br>
<input type="button" value="Encriptar" onclick="codificar()"> <!-- Boton encriptar anidado a la función codificar del script -->
<input type="button" value="Previsualizar" onclick="previsualizar()"> <!-- Boton previsualizar anidado a la función previsualizar del script -->
<input type="button" value="Seleccionar" onclick="seleccionar()"> <!-- Boton selecciónar anidado a la función seleccionar del script -->
<input type="button" value="Desencriptar" onclick="decompilar()"> <!-- Boton desencriptar anidado a la función decompilar del script -->
<input type="reset" value="Borrar"> <!-- Boton borrar para eliminar el contenido de la caja -->
</div>
</form>
</body>
</html>
Aclaro que no podras protegerlo al 100% una vez mas
Hay encriptadores mas avanzados, por ahí vi una web que no pude desencriptar
pero bueno, esa es otra historia...