Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide form code from view code/inspect element browser?

I want to hide form code from view code/inspect element browser , how can i do that ?

This is my code, please see below:

<div style=" text-align: center;  padding: 300px; font-family: lato; ">      Please wait redirect page ......<br>     <img src="http://maps.nrel.gov/sites/all/modules/custom_modules/hydra/assets/images/loading_bar.gif" border="0"> </div>   <form name="f1" action="payments.php" method="post"> <input type="hidden" name="id_crad" value="..."> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="amount" value="12.99"> </form>   <script type="text/javascript"> setTimeout(function(){f1.submit();}, 3000); </script> 

Please see picture

enter image description here

like image 566
user3758584 Avatar asked Jun 20 '14 04:06

user3758584


People also ask

How do you hide something on Inspect Element?

We can hide an element by inspecting it with Chrome DevTools, right-clicking the element under the Elements tab, and choosing the Hide element menu from the context menu. If you're a fan of using the shortcut, then pressing the <kbd>h</kbd> key has the same effect.

How do I hide source code from public view?

After encrypting it, you can just write a basic HTML page just putting into the <head> tag once again the script to disable the right click, into the <body> tag you code and hide everything just writing at top of the page <html hidden> .

How do I hide HTML code?

To create hidden comments in HTML, add <! --- tag and end it with -- >. Whatever comes inside it is hidden.


1 Answers

You simply can't.

Code inspectors are designed for debugging HTML and JavaScript. They do so by showing the live DOM object of the web page. That means it reveals HTML code of everything you see on the page, even if they're generated by JavaScript. Some inspectors even shows the code inside Iframes.

How about some JavaScript to disable keyboard / mouse interaction...

There are some JavaScript tricks to disable some keyboard, mouse interaction on the page. But there always are work around to those tricks. For instance, you can use the browser top menu to enable DOM inspector without a problem.

Try theses:

  • Firefox: ☰ > Tools > Web Developer > Inspector
  • Chrome: ⋮ > More Tools > Developer Tools > Elements

They are outside the control of JavaScript.

Big Picture

Think about this:

  1. Everything on a web page is rendered by the browser, so they are of a lower abstraction level than your JavaScript. They are "guarding all the doors and holding all the keys".
  2. Browsers want web sites to properly work on them or their users would despise them.
  3. As a result, browsers want to expose the lower level ticks of everything to the web developers with tools like code inspectors.

Basically, browsers are god to your JavaScript. And they want to grant the web developer super power with code inspectors. Even if your trick works for a while, the browsers would want to undo it in the future.

You're waging war against god and you're doomed to fail.

Conclusion

To put it simple, if you do not want people to get something in their browser, you should never send it to their browser in the first place.

like image 112
Koala Yeung Avatar answered Oct 10 '22 20:10

Koala Yeung