Jump to content

Ask about HTML encoding


Recommended Posts

orig_pass = prompt("Please enter password","");

To remove the password prompt, just replace the above line with whichever fixed value you want.

orig_pass = "XYZ";

 

This code is not very good, the variables aren't properly declared and they're using outdated attributes. If you're intending to hide your source code from people, I will have to warn you that it is impossible. If the browser is able to read the source code then so can anybody.

  • Thanks 1
Link to post
Share on other sites

Actually, to remove the password from the generated HTML, just cut out everything and only keep these lines:

<script language="JavaScript1.2">
orig = unescape( /* ... ... ... ... */ );
orig1 = orig1.replace(/mmm/g,"\r\n");
document.write(orig1);
</script>
<noscript>JavaScript must be enabled in your browse in order to see protected page.</noscript>

 

  • Thanks 1
Link to post
Share on other sites
15 minutes ago, Ingolme said:

Để xóa lời nhắc mật khẩu, chỉ cần thay thế dòng trên bằng bất kỳ giá trị cố định nào bạn muốn.


 

Mã này không tốt lắm, các biến không được khai báo đúng cách và chúng đang sử dụng các thuộc tính lỗi thời. Nếu bạn đang có ý định giấu mã nguồn của mình với mọi người, tôi sẽ phải cảnh báo bạn rằng điều đó là không thể. Nếu trình duyệt có thể đọc mã nguồn thì bất kỳ ai cũng có thể.

Thanks for your help, can you guide me on another encoding?

Link to post
Share on other sites

It is impossible to protect HTML code, but I will do what you asked.

Here is the above code without password:

<html>
<head><title>Encryptor</title></head>
<body>
<div id="thecode" style="display:none">
&lt;script&gt;
document.write(unescape("thecode"));
&lt;/script&gt;
&lt;noscript&gt;JavaScript must be enabled in your browse in order to see protected page.&lt;/noscript&gt;
</div>

  <script>
  function do_encode() {
    orig = document.getElementById("as1").value;
    thecode1 = document.getElementById("thecode").innerHTML;
    thecode1 = thecode1.replace(/&lt;/g,'<');
    thecode1 = thecode1.replace(/&gt;/g,'>');
    thecode1 = thecode1.replace(/&amp;/g,'&');
    orig1 = thecode1.replace(/thecode/,escape(orig));
    document.getElementById("as2").value = orig1;
  }
  </script>
  <b>Enter your HTML code to be encrypted:<br></b>
  <textarea id="as1" rows="10" cols="50"></textarea><br>
  <button onclick="do_encode()">Click Here to Encrypt and Password Protect Your HTML</button><br>
  <br>
  This is your protected HTML page text. Save this text as an HTML file:<br>
  <textarea id="as2" rows="10" cols="50"></textarea>
</body>
</html>

 

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...