Proposal: browser-lib attribute for native inclusion of common libraries (BWL)
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
People
(Reporter: info, Unassigned)
Details
Steps to reproduce:
Proposal: Built-In Web Libraries (BWL) via browser-lib Attribute
Summary
This proposal introduces a new optional HTML attribute, browser-lib, to <script> and <link> elements, enabling modern browsers to natively serve popular open-source libraries (e.g., jQuery, Bootstrap, Tailwind CSS) directly from within the browser binary, rather than fetching them from the network. The attribute uses the following format:
<script src="..." browser-lib="jquery@3.6.0"></script>
<link href="..." browser-lib="bootstrap@5.3.2" rel="stylesheet">
Motivation
Web developers across the globe rely heavily on a small number of widely used frontend libraries. These include:
- jQuery (used by millions of sites)
- Bootstrap (used for UI/UX layout and components)
- Tailwind CSS (popular utility-first framework)
Despite widespread usage and relatively static versions in production, every website still fetches its own copy of these libraries, leading to:
- Unnecessary bandwidth consumption
- Redundant storage and caching
- Slower page load times
- Increased data usage, especially on mobile networks
Built-In Web Libraries (BWL) solves this by embedding selected versions of these libraries directly inside the browser. With a simple browser-lib hint, developers can request the browser to use its built-in copy, falling back to external loading if not available.
How It Works
-
The developer includes the browser-lib attribute with the desired library name and exact version:
<script src="/fallback/jquery.js" browser-lib="jquery@3.6.0"></script>
-
If the browser supports this feature and includes jquery@3.6.0 internally:
- It ignores the external src
- Injects the native library directly into the DOM
-
If not:
- The browser loads from the src or href path as normal (graceful fallback)
Browser Storage Considerations
- Libraries are bundled within the browser itself as part of its installation or update package
- Stored in a read-only, signed, compressed format
- Only stable and commonly used versions are included to avoid bloat
- Examples:
- jQuery 3.6.0
- Bootstrap 5.3.2
- Tailwind CSS 3.4.1
- Total estimated space usage: ~30MB
- No network access required — ensures perfect load speed and consistency
Benefits
- Zero-latency load for embedded libraries
- Reduced bandwidth for both clients and servers
- Eco-friendly: Less global data transfer
- Security: Controlled and verified versions only
- Developer freedom: Still able to override by simply omitting browser-lib
Security and Compatibility
- Only libraries with open-source licenses, wide adoption, and stable release cycles are eligible
- Strict version matching, no wildcards or loose versioning
- Fully backward compatible:
- Browsers that do not recognize browser-lib will simply use the standard src or href
- No runtime errors or behavioral inconsistencies
Example Usage
<link rel="stylesheet" href="/vendor/bootstrap.css" browser-lib="bootstrap@5.3.2">
<link rel="stylesheet" href="/vendor/tailwind.css" browser-lib="tailwind@3.4.1">
<script src="/vendor/jquery.js" browser-lib="jquery@3.6.0"></script>
Naming and Specification
This mechanism is referred to as Built-In Web Libraries (BWL).
The proposed HTML attribute is:
browser-lib="library@version"
Supported elements:
- <script>
- <link rel="stylesheet">
Conclusion
Built-In Web Libraries (BWL) represent a lightweight, forward-compatible enhancement to the modern web stack. By leveraging the enormous redundancy of frontend libraries across websites, browsers can unlock tremendous performance, reduce global data waste, and enhance user experience, all without breaking existing standards.
We invite the firefox team and web standards community to consider integrating this proposal for a faster, leaner, and more efficient web.
Description
•