Att Keygen Autofocus
# HTML <keygen> autofocus Attribute
The `` element was introduced in HTML5 to facilitate the generation of key pairs for web-based client certificate management. The `autofocus` attribute is a boolean attribute used to automatically focus the `` element when the page loads.
---
## Definition and Usage
The `autofocus` attribute specifies that the `` element should automatically receive focus as soon as the web page finishes loading.
As a **boolean attribute**, its presence on the element triggers the behavior. You do not need to assign a value to it in standard HTML.
---
## Syntax
In standard HTML, you can write the attribute as a standalone keyword:
```html
```
### HTML vs. XHTML Syntax Difference
* **HTML:** ``
* **XHTML:** In XHTML, attribute minimization is strictly forbidden. The attribute must be explicitly defined with its value:
```xml
```
---
## Code Example
The following example demonstrates how to apply the `autofocus` attribute to a `` element within a form. When this page loads, the "Encryption" dropdown selection will automatically receive focus.
```html
```
---
## Browser Support and Deprecation Notice
Historically, the `autofocus` attribute for the `` element was supported by early versions of Google Chrome, Safari, and Opera. However, modern web developers must take note of the following critical compatibility status:
| Feature | Chrome | Firefox | Safari | Edge / IE | Opera |
| :--- | :--- | :--- | :--- | :--- | :--- |
| `` Support | **Removed** | **Removed** | **Removed** | **Never Supported** | **Removed** |
### Important Considerations
1. **Deprecation and Removal:** The `` element itself has been **deprecated and completely removed** from the HTML standard (HTML LS / HTML5.1) due to security concerns and lack of consistent implementation across browsers.
2. **Modern Alternatives:** If you need to handle cryptographic keys, digital signatures, or client-side certificates in modern web applications, you should use the secure and widely supported **Web Cryptography API (WebCrypto)** instead of the obsolete `` tag.
YouTip