Open In App

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

Last Updated : 17 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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:


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads