I was just actually wondering if there is a permanent way of preventing or disabling inspect element on client-side?

Assuming with inspect element you could change values in hidden forms as well as removing validation inputs etc.

Perhaps a Java-script code that disables inspect element? What is the best approach to disable or prevent inspect element modifications? Coding wise?

With Java-script code in preventing it but that will cause the client-side to disable Java-script on their browser and still manage to inspect element?

Anyways people could just download your source code and modify them offline instead.


The only thing to know when coding an application is that you should not trust the client. This being said, all calculations that you do client-side need to be checked and sanitized by the server. If everything is properly sanitized, then you do not need to block something on the browser.

Furthermore, let's say that you use a Javascript function dontAllowInspection(). Nothing prevents the user to go to the chromium source code repo, get the code for the Javascript processor and disable dontAllowInspection() so that it is not followed even if it's specifically called by your website.

And finally, it's just frustrating. Have you ever been to a website that blocks right-click and shows you an alert() pop-up to tell you that you can't right-click ? It just bring frustration and curiosity on what you need to hide from plain view.

So even if what you ask is possible, which I sincerly doubt since you can only block pressed keys and right click (browsers have a menu which bypass these), you should not do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.