<keygen>
HTML <keygen> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <form action="demo_keygen.php" method="get"> 用户名: <input type="text" name="usr_name"> 加密: <keygen name="security"> <input type="submit"> </form> <p><strong>注意:</strong> Internet Explorer 不支持 keygen 标签。</p> </body> </html>
Run Example»
Click the "Run Instance" button to view the online instance
Browser support
Firefox, Opera, Chrome and Safari 6 All support the <keygen> tag.
Tag definition and usage instructions
<keygen> The tag specifies the key pair generator field used in the form.
When the form is submitted, the private key is stored locally and the public key is sent to the server.
Differences between HTML 4.01 and HTML5
The<keygen> element is the HTML5 new tag.
Attributes
New: HTML5 new attributes.
Properties | Value | Description |
---|---|---|
autofocusNew | autofocus | Causes the <keygen> field to gain focus when the page loads. |
challengeNew | challenge | If used, sets the value of keygen to ask on commit. |
disabledNew | disabled | Disables the <keygen> element field. |
formNew | form_id | Define an or Multiple forms. |
keytypeNew | rsa dsa ec | defines the security algorithm of the key. |
nameNew | name | defines the unique name of the <keygen> element. The name attribute is used to collect the value of the field when submitting the form. |
Events Attribute<keygen> tag supports all HTML event attributes.