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 comment
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");
<noscript>JavaScript must be enabled in your browse in order to see protected page.</noscript>


  • Thanks 1
Link to comment
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 comment
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:

<div id="thecode" style="display:none">
&lt;noscript&gt;JavaScript must be enabled in your browse in order to see protected page.&lt;/noscript&gt;

  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;
  <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>
  This is your protected HTML page text. Save this text as an HTML file:<br>
  <textarea id="as2" rows="10" cols="50"></textarea>


  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...