oc1ober Posted February 28, 2021 Share Posted February 28, 2021 I found the HTML encoding code, It works the way is encoding plus set password, It works very well ... But what I need is only HTML encoding, not password setting. I edited the above code myself but it doesn't work and need your help? And here is the code: https://www.w3schools.com/code/tryit.asp?filename=GO520MFBKDUJ Link to comment Share on other sites More sharing options...
Ingolme Posted March 1, 2021 Share Posted March 1, 2021 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. 1 Link to comment Share on other sites More sharing options...
Ingolme Posted March 1, 2021 Share Posted March 1, 2021 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> 1 Link to comment Share on other sites More sharing options...
oc1ober Posted March 1, 2021 Author Share Posted March 1, 2021 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 More sharing options...
Ingolme Posted March 1, 2021 Share Posted March 1, 2021 You will need to clarify exactly what you want. 1 Link to comment Share on other sites More sharing options...
oc1ober Posted March 1, 2021 Author Share Posted March 1, 2021 29 minutes ago, Ingolme said: Bạn sẽ cần phải làm rõ chính xác những gì bạn muốn. I need to edit the above code, Encrypt only, no need to create password? Link to comment Share on other sites More sharing options...
Ingolme Posted March 1, 2021 Share Posted March 1, 2021 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"> <script> document.write(unescape("thecode")); </script> <noscript>JavaScript must be enabled in your browse in order to see protected page.</noscript> </div> <script> function do_encode() { orig = document.getElementById("as1").value; thecode1 = document.getElementById("thecode").innerHTML; thecode1 = thecode1.replace(/</g,'<'); thecode1 = thecode1.replace(/>/g,'>'); thecode1 = thecode1.replace(/&/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> 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now