Block HTML source code

Asked

Viewed 766 times

-5

Good afternoon, you guys! I have done a good search, but nothing solved me, there is some way to block my Source Code or leave it confused, for future copies (site made in Html5). orbed!

  • 2

    html must reach the browser to show it, so there is no way to block it, otherwise the page will not appear. some things like images can be transformed into bytes for example, mimicking the code, but nothing that prevents the code from reaching the browser. Keep what you don’t want seen by the user on the server side

  • 1

    First, what kind of code do you want to hide? And if you want to hide, how can the browser guarantee the user’s safety? If it is hidden as you think Google will index? Reflect

1 answer

3

So Vitor, usually not an html markup obfuscator is used, but a google search in: html obfuscate.

I signed in to a site that gave html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Joostrap</title>
</head>
<body>
    <script src="dist/bundle.js"></script>
</body>
</html>

he generated a return of:

<script language="javascript">
<!--
// == Begin Free HTML Source Code Obfuscation Protection from http://snapbuilder.com == //
document.write(unescape('%3C%21%44%4F%43%54%59%50%45%20%68%74%6D%6C%3E%0A%3C%68%74%6D%6C%20%6C%61%6E%67%3D%22%65%6E%22%3E%0A%3C%68%65%61%64%3E%0A%20%20%20%20%3C%6D%65%74%61%20%63%68%61%72%73%65%74%3D%22%55%54%46%2D%38%22%3E%0A%20%20%20%20%3C%6D%65%74%61%20%6E%61%6D%65%3D%22%76%69%65%77%70%6F%72%74%22%20%63%6F%6E%74%65%6E%74%3D%22%77%69%64%74%68%3D%64%65%76%69%63%65%2D%77%69%64%74%68%2C%20%69%6E%69%74%69%61%6C%2D%73%63%61%6C%65%3D%31%2E%30%22%3E%0A%20%20%20%20%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%58%2D%55%41%2D%43%6F%6D%70%61%74%69%62%6C%65%22%20%63%6F%6E%74%65%6E%74%3D%22%69%65%3D%65%64%67%65%22%3E%0A%20%20%20%20%3C%74%69%74%6C%65%3E%4A%6F%6F%73%74%72%61%70%3C%2F%74%69%74%6C%65%3E%0A%3C%2F%68%65%61%64%3E%0A%3C%62%6F%64%79%3E%0A%20%20%20%20%3C%73%63%72%69%70%74%20%73%72%63%3D%22%64%69%73%74%2F%62%75%6E%64%6C%65%2E%6A%73%22%3E%3C%2F%73%63%72%69%70%74%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E'));
//-->
</script>

but it affects performance in a bad way.

You can also search for html minificators, if you know Node has this lib that minifies your html:

npm from html-minifier-Loader lib

  • Very good answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.