Skip to content
Related Articles

Related Articles

Improve Article

How to specify that a keygen element should be disabled in HTML ?

  • Last Updated : 17 Mar, 2021

The <keygen>element in HTML helps in encryption key generation so that data can be transferred between the server and client securely. This encryption may affect the user experience and reduce website performance in the case of users with fewer system requirements. This can cause issues in the user interface and may lead to confusion in the usage of the website. Therefore, the need may arise to disable it in unnecessary situations.

This can be achieved by using the disabled attribute of the <keygen> element. This will prevent the element from generating the key-value pairs it is supposed to generate.

Syntax:

<keygen name="security" disabled>

Example: In the below example, the <keygen> element is disabled using the disabled attribute.

HTML




<html>
<body>
  <h1 style="color: green;">
    GeeksforGeeks
  </h1>
  <h3>Disabling the keygen element</h3>
  <!-- Form for enclosing all the
  available inputs -->
  <form method="post" action="/">
  
    <label for="name">Your username</label>
    <input type="text" name="name">
    <br><br>
    <label for="name">Your password</label>
    <input type="password" name="pass">
    <br><br>
  
    <!-- Disable the <keygen> element using
    the disabled attribute -->
    Encryption Element Value:
    <keygen name="security" disabled>
    <br><br>
    <input type="submit">
  </form>
</body>
</html>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :