Hide HTML source code from page

Asked

Viewed 383 times

-1

Is it possible to hide the source code from the page? I wonder why Twitter seems to use this technique. Look:

<!DOCTYPE html>
<html lang="pt">
<head>
  <meta charset="utf-8" />
  <title>Twitter</title>
  <style>
  body {
    background-color: #ffffff;
    font-family: sans-serif;
  }
  a {
    color: #1da1f2;
  }
  svg {
    color: #1da1f2;
    display: block;
    fill: currentcolor;
    height: 21px;
    margin: 13px auto;
    width: 24px;
  }
  </style>
</head>
<body>
    <noscript>      
      <center>Se você não for redirecionado em breve, <a href="/">use este link</a>.</center>
    </noscript>
    <script nonce="+S++B3GsGLtBoFsjmI2+Pg==">
       document.cookie = "app_shell_visited=1;path=/;max-age=5";
       location.replace(location.href.split("#")[0]);
    </script>
</body>
</html>
  • 2

    I can normally see the twitter source code when using the developer tool, but when viewing the source code of the page CTRL+U the whole code does not appear because the twitter elements are loaded after loading the page, you can notice this when giving F5 (reload the page)

  • Possible duplicate of Hide JS code

  • 1

    Mate, it’s not duplicate. The other colleague’s question is to hide JS and in mine is the entire HTML as it occurs on Twitter (without the developer tool) and yes seeing directly the source code.

1 answer

1

It is possible to hide relevant parts of logic behind a page using a server-side language like PHP. With PHP, for example, you won’t be able to see things like the code used to log in to a page or the function that gives you access to a bank account balance. But there will always be some HTML to be displayed in the browser (which are the elements with which the user can intaragir), so some HTML code is always visible.

Browser other questions tagged

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