The <command>
tag was intended to define a command that a user could invoke, such as a menu item, button, or keyboard shortcut in web applications. It was designed to be used with the <menu>
element.
Example (original intention):
<menu type="toolbar">
<command label="Save" icon="save.png" onclick="saveFile()">
</menu>
❌ Why It’s Obsolete
- The
<command>
tag was never fully implemented in most browsers. - It was part of an early HTML5 draft but later removed due to lack of support and better alternatives using JavaScript +
<button>
or<a>
.
As of now:
- Not supported in major browsers (Chrome, Firefox, Safari, Edge)
- Not valid in modern HTML documents
✅ Modern Alternative
Use a <button>
with JavaScript for functionality:
<button onclick="saveFile()">💾 Save</button>
Or, in a context menu:
<nav>
<ul>
<li><a href="#" onclick="saveFile()">Save</a></li>
<li><a href="#" onclick="print()">Print</a></li>
</ul>
</nav>
🧠 Summary
Feature | <command> Tag |
---|---|
Purpose | Define user-invokable command (menu/button) |
Status | ❌ Obsolete / Deprecated in HTML5 |
Browser Support | ❌ Not supported in modern browsers |
Alternative | ✅ Use <button> , <a> , and JavaScript |
📌 TL;DR
The <command>
tag was meant for advanced UI features but was never widely adopted. Instead, use buttons, menus, and JavaScript for interactive web applications.