skip to Main Content

how to avoid users eliminating css using inspect element?
let’s say I have a form where if all inputs are not filled in then the submit button has the disabled style, but if you inspect the element and remove the CSS the user can submit even though all the form is not filled in, is there any insight for me?

2

Answers


  1. You can’t. HTML, CSS and Javascript are executed at the client side. He can do what he wants if he knows how.

    It is very important to validate the form on server side too because the user can not access the server.

    Login or Signup to reply.
  2. To be honest no, you can’t avoid user to access inspect element, but you can prevent user to press :

    1. Right Click
    2. F12
    3. Ctrl + Shift + I
    4. Ctrl + Shift + J
    5. Ctrl + U
    //keys
    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;
      }
    }
    //right-click
    <body oncontextmenu="return false">

    Source: andrewstutorials.blogspot.com

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search