Seeking an Answer: Why can't HTML alone do includes?
a year ago
- #frontend
- #web-development
- #html
- The article discusses the lack of a native HTML solution for including HTML fragments across multiple pages, a common need in web development.
- Various workarounds exist (JavaScript, server-side includes, static site generators, etc.), but none are pure HTML.
- Potential reasons for the absence include performance issues, security concerns, complexity with nested/circular includes, and historical HTML standardization decisions.
- HTML imports were once proposed but deprecated due to lack of browser support and being tied to Web Components.
- The discussion highlights the gap between developer needs and HTML's evolution, with many solutions relying on external tools or JavaScript.
- HTMX is mentioned as a close-to-HTML solution for dynamic content inclusion.
- Security and rendering challenges (CSP, CORS, meta tags, etc.) make native HTML includes complex to implement.
- The article reflects on how HTML's standardization process may have hindered the adoption of such features.