What's the best way to enhance website security in inspect element?

1.2k Views Asked by At

Is there a way for prevent any user from editing my html code from UI using inspect element ? I have done research there's many why to prevent inspect element ( or Right-Click ) but seems not all of them are effective .

So my question is how to prevent the user from editing my HTML Code using inspect element and what's more suggestion I can add to enhance website security?

2

There are 2 best solutions below

0
symcbean On

You are going off on a tangent. No there is no way to prevent a user from editing content they have downloaded to their computer. But they are not editing your website - the website security is not being compromised.

3
aiyan On

There is no way to completely block inspect element.

You can try to prevent amateur users from doing it by blocking the context menu that shows up on right click.

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

Users will not be able to access this:

enter image description here

It is completely normal to view a website's frontend HTML code.

As long as you use good backend practices, there will be no security issues.