How to Hide Form Code from View Code/Inspect Element Browser

Is this safe to use to hide code from view code / inspect?

In an answer about as useful as the question,

"No".

Most of us can't read the code because it is packed/obfuscated, and won't invest the time to try to read it.

  • If you're asking if it will prevent the user from opening the Developer Tools, then I don't know, because that would require me trying to run the code, which I'm not going to do, since I can't read the code and it could be malicious.

  • If you're asking if it will prevent someone from obtaining the rest of the code on your website, then no, it will not. A determined user could use curl or one of several other tools to retrieve the raw HTML or Javascript.

  • If you're asking if the code pasted above is secure because it is packed, then no, it is not. A determined user could quite easily analyze the code by hand and, once analyzed, write something to reverse engineer the packed code (that's assuming it uses an unknown packer -- if it uses a well-known packer, then someone has probably already written something to reverse it).

Is there a way to prevent the theft of a website's code?

One can never fully block a determined user from analyzing your code, only make things more annoying from them.

Simply using a minifier/uglifier on Javascript is usually enough to make the code mostly worthless to try to steal, since the cost of trying to analyze, rewrite it and further develop it is usually comparable to the cost of writing the same code from scratch.

How to hide html content from inspect element of developer tools?

You cannot secure your front-end, but you can certainly secure your server-side!

Good luck

how to hide html code when inspecting in codeigniter?

<script type="text/javascript">
document.onkeydown = function(e) {
if(event.keyCode == 123) {
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'C'.charCodeAt(0)){
return false;
}

}

Is it possible to remove Inspect Element?

It is possible to prevent the user from opening the context menu by right clicking like this (javascript):

document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});

By listening to the contextmenu event and preventing the default behavior which is "showing the menu", the menu won't be shown.
But the user will still be able to inspect code through the console (by pressing F12 in Chrome for example).



Related Topics



Leave a reply



Submit