<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://knowledgebase.pirho.net/index.php?action=history&amp;feed=atom&amp;title=JavaScript_for_Everyone</id>
	<title>JavaScript for Everyone - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://knowledgebase.pirho.net/index.php?action=history&amp;feed=atom&amp;title=JavaScript_for_Everyone"/>
	<link rel="alternate" type="text/html" href="https://knowledgebase.pirho.net/index.php?title=JavaScript_for_Everyone&amp;action=history"/>
	<updated>2026-07-11T11:41:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://knowledgebase.pirho.net/index.php?title=JavaScript_for_Everyone&amp;diff=409&amp;oldid=prev</id>
		<title>Dex: Created page with &quot;&#039;&#039;&#039;Summary:&#039;&#039;&#039;  JavaScript has evolved significantly since its introduction in the 1990s. Modern JavaScript development often assumes the availability of recent browser features, build pipelines, transpilers, package managers, and evergreen browser updates. While these technologies have improved developer productivity, they can also reduce the range of clients capable of running an application.  This article explores a compatibility-first approach to JavaScript developme...&quot;</title>
		<link rel="alternate" type="text/html" href="https://knowledgebase.pirho.net/index.php?title=JavaScript_for_Everyone&amp;diff=409&amp;oldid=prev"/>
		<updated>2026-07-05T14:08:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Summary:&amp;#039;&amp;#039;&amp;#039;  JavaScript has evolved significantly since its introduction in the 1990s. Modern JavaScript development often assumes the availability of recent browser features, build pipelines, transpilers, package managers, and evergreen browser updates. While these technologies have improved developer productivity, they can also reduce the range of clients capable of running an application.  This article explores a compatibility-first approach to JavaScript developme...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Summary:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
JavaScript has evolved significantly since its introduction in the 1990s. Modern JavaScript development often assumes the availability of recent browser features, build pipelines, transpilers, package managers, and evergreen browser updates. While these technologies have improved developer productivity, they can also reduce the range of clients capable of running an application.&lt;br /&gt;
&lt;br /&gt;
This article explores a compatibility-first approach to JavaScript development. By using broadly supported language features, implementing feature detection, embracing progressive enhancement, and understanding the history of browser scripting engines, developers can deliver applications that remain accessible to the widest possible audience.&lt;br /&gt;
&lt;br /&gt;
== Context ==&lt;br /&gt;
&lt;br /&gt;
The web is often viewed through the lens of modern desktop and mobile browsers. However, many environments continue to rely upon older JavaScript engines and legacy browsers.&lt;br /&gt;
&lt;br /&gt;
Examples include:&lt;br /&gt;
&lt;br /&gt;
* Corporate intranet applications&lt;br /&gt;
* Embedded administration interfaces&lt;br /&gt;
* Industrial control systems&lt;br /&gt;
* Kiosk systems&lt;br /&gt;
* Legacy line-of-business applications&lt;br /&gt;
* Long-term support operating systems&lt;br /&gt;
* Assistive technologies using embedded browser controls&lt;br /&gt;
&lt;br /&gt;
A compatibility-first development strategy does not reject modern features. Instead, it asks a simple question:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
How can we deliver the best possible experience to modern browsers while maintaining functional access for older clients?&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A Brief History of JavaScript ==&lt;br /&gt;
&lt;br /&gt;
JavaScript did not emerge fully standardised.&lt;br /&gt;
&lt;br /&gt;
During the early years of the web, multiple browser vendors implemented their own scripting engines.&lt;br /&gt;
&lt;br /&gt;
Notable implementations included:&lt;br /&gt;
&lt;br /&gt;
* Netscape JavaScript&lt;br /&gt;
* Microsoft JScript&lt;br /&gt;
* Opera&amp;#039;s JavaScript implementation&lt;br /&gt;
&lt;br /&gt;
Although the ECMAScript standard eventually brought consistency to the language, browser differences remained significant for many years.&lt;br /&gt;
&lt;br /&gt;
Developers frequently encountered differences in:&lt;br /&gt;
&lt;br /&gt;
* Event handling&lt;br /&gt;
* Document Object Model (DOM) behaviour&lt;br /&gt;
* Object implementations&lt;br /&gt;
* Security models&lt;br /&gt;
* Supported language features&lt;br /&gt;
&lt;br /&gt;
An understanding of this history explains why many experienced developers still favour defensive programming techniques and compatibility testing.&lt;br /&gt;
&lt;br /&gt;
== Understanding the Compatibility Pyramid ==&lt;br /&gt;
&lt;br /&gt;
The further back a browser&amp;#039;s capabilities extend, the larger the potential audience becomes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                 Modern ECMAScript&lt;br /&gt;
                        ▲&lt;br /&gt;
                        │&lt;br /&gt;
                   ES Modules&lt;br /&gt;
                        ▲&lt;br /&gt;
                        │&lt;br /&gt;
                     ES2015&lt;br /&gt;
                        ▲&lt;br /&gt;
                        │&lt;br /&gt;
                       ES5&lt;br /&gt;
                        ▲&lt;br /&gt;
                        │&lt;br /&gt;
                    JScript&lt;br /&gt;
                        ▲&lt;br /&gt;
                        │&lt;br /&gt;
                    DOM Level 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each layer introduces additional capabilities.&lt;br /&gt;
&lt;br /&gt;
Applications designed for maximum compatibility typically establish a foundation at the lower levels and progressively enhance functionality as more capabilities become available.&lt;br /&gt;
&lt;br /&gt;
== Why ES5 Remains Important ==&lt;br /&gt;
&lt;br /&gt;
ECMAScript 5 (ES5) remains one of the most widely supported versions of JavaScript ever released.&lt;br /&gt;
&lt;br /&gt;
Features such as:&lt;br /&gt;
&lt;br /&gt;
* Variables using &amp;lt;code&amp;gt;var&amp;lt;/code&amp;gt;&lt;br /&gt;
* Function declarations&lt;br /&gt;
* Arrays&lt;br /&gt;
* Objects&lt;br /&gt;
* Regular expressions&lt;br /&gt;
* Date handling&lt;br /&gt;
* String manipulation&lt;br /&gt;
&lt;br /&gt;
are available across virtually all modern browsers and a large number of legacy environments.&lt;br /&gt;
&lt;br /&gt;
Because of this, ES5 frequently serves as a practical baseline when broad compatibility is required.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var message = &amp;quot;Hello World&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
function greet(name)&lt;br /&gt;
{&lt;br /&gt;
    return &amp;quot;Hello &amp;quot; + name;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example executes successfully in a wide range of browsers spanning multiple decades.&lt;br /&gt;
&lt;br /&gt;
== Progressive Enhancement ==&lt;br /&gt;
&lt;br /&gt;
Progressive enhancement is the practice of building a solution from a reliable foundation and then adding more advanced functionality when supported.&lt;br /&gt;
&lt;br /&gt;
A common model is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
HTML&lt;br /&gt;
 ▲&lt;br /&gt;
 │&lt;br /&gt;
CSS&lt;br /&gt;
 ▲&lt;br /&gt;
 │&lt;br /&gt;
JavaScript&lt;br /&gt;
 ▲&lt;br /&gt;
 │&lt;br /&gt;
Advanced JavaScript&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every layer enhances the user experience without making the previous layer unusable.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* HTML provides content.&lt;br /&gt;
* CSS improves presentation.&lt;br /&gt;
* JavaScript improves interactivity.&lt;br /&gt;
* Modern APIs provide additional convenience.&lt;br /&gt;
&lt;br /&gt;
If one layer becomes unavailable, the layers below continue to function.&lt;br /&gt;
&lt;br /&gt;
== Graceful Degradation ==&lt;br /&gt;
&lt;br /&gt;
Graceful degradation is closely related to progressive enhancement.&lt;br /&gt;
&lt;br /&gt;
Rather than asking:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
What can the newest browser do?&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it asks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
What happens when this feature is unavailable?&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
if (window.localStorage)&lt;br /&gt;
{&lt;br /&gt;
    window.localStorage.setItem(&amp;quot;theme&amp;quot;, &amp;quot;dark&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The application can continue operating even if persistent storage is unavailable.&lt;br /&gt;
&lt;br /&gt;
The user may lose convenience, but core functionality remains intact.&lt;br /&gt;
&lt;br /&gt;
== Feature Detection vs Browser Detection ==&lt;br /&gt;
&lt;br /&gt;
One of the most important compatibility practices is feature detection.&lt;br /&gt;
&lt;br /&gt;
=== Avoid Browser Detection ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
if (navigator.userAgent.indexOf(&amp;quot;Chrome&amp;quot;) &amp;gt; -1)&lt;br /&gt;
{&lt;br /&gt;
    // Chrome-specific logic&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
User agent strings can be inaccurate, spoofed, or change over time.&lt;br /&gt;
&lt;br /&gt;
=== Prefer Feature Detection ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
if (window.addEventListener)&lt;br /&gt;
{&lt;br /&gt;
    // Modern event handling&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
    // Legacy fallback&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Feature detection focuses on actual capability rather than assumptions.&lt;br /&gt;
&lt;br /&gt;
== Supporting Multiple Event Models ==&lt;br /&gt;
&lt;br /&gt;
One of the historic challenges of cross-browser development involved event registration.&lt;br /&gt;
&lt;br /&gt;
=== Modern Event Registration ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
element.addEventListener(&amp;quot;click&amp;quot;, handler, false);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Legacy Internet Explorer ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
element.attachEvent(&amp;quot;onclick&amp;quot;, handler);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A compatibility layer can support both:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function addEvent(element, eventName, handler)&lt;br /&gt;
{&lt;br /&gt;
    if (element.addEventListener)&lt;br /&gt;
    {&lt;br /&gt;
        element.addEventListener(eventName, handler, false);&lt;br /&gt;
    }&lt;br /&gt;
    else if (element.attachEvent)&lt;br /&gt;
    {&lt;br /&gt;
        element.attachEvent(&amp;quot;on&amp;quot; + eventName, handler);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This pattern proved effective for many years and remains useful when supporting older browsers.&lt;br /&gt;
&lt;br /&gt;
== Working with Modern APIs ==&lt;br /&gt;
&lt;br /&gt;
Modern browsers provide many useful capabilities, including:&lt;br /&gt;
&lt;br /&gt;
* Fetch API&lt;br /&gt;
* Promise&lt;br /&gt;
* MutationObserver&lt;br /&gt;
* IntersectionObserver&lt;br /&gt;
* Web Storage&lt;br /&gt;
* Service Workers&lt;br /&gt;
&lt;br /&gt;
However, these capabilities should not be assumed.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
if (window.fetch)&lt;br /&gt;
{&lt;br /&gt;
    fetch(&amp;quot;/api/data&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
    var xhr = new XMLHttpRequest();&lt;br /&gt;
    xhr.open(&amp;quot;GET&amp;quot;, &amp;quot;/api/data&amp;quot;, true);&lt;br /&gt;
    xhr.send();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows modern browsers to use newer functionality while maintaining support for older environments.&lt;br /&gt;
&lt;br /&gt;
== JavaScript Namespaces ==&lt;br /&gt;
&lt;br /&gt;
Before native modules became widely available, many applications organised code using namespaces.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var PiRho = PiRho || {};&lt;br /&gt;
&lt;br /&gt;
PiRho.Data = PiRho.Data || {};&lt;br /&gt;
PiRho.Data.Source = {};&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Benefits include:&lt;br /&gt;
&lt;br /&gt;
* Logical code organisation&lt;br /&gt;
* Reduced global namespace pollution&lt;br /&gt;
* Broad browser compatibility&lt;br /&gt;
* No dependency on module loaders&lt;br /&gt;
&lt;br /&gt;
Many large applications successfully used namespace-based architectures long before ES Modules were introduced.&lt;br /&gt;
&lt;br /&gt;
== ES Modules and Compatibility ==&lt;br /&gt;
&lt;br /&gt;
ES Modules provide a modern mechanism for separating and organising code.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
import { Widget } from &amp;quot;./Widget.js&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Advantages include:&lt;br /&gt;
&lt;br /&gt;
* Explicit dependencies&lt;br /&gt;
* Improved maintainability&lt;br /&gt;
* Better developer onboarding&lt;br /&gt;
* Enhanced tooling support&lt;br /&gt;
&lt;br /&gt;
However, ES Modules should be viewed as an enhancement when broad compatibility is required.&lt;br /&gt;
&lt;br /&gt;
One effective strategy is:&lt;br /&gt;
&lt;br /&gt;
# Author code using ES Modules.&lt;br /&gt;
# Transpile modules into a namespace-based format.&lt;br /&gt;
# Continue supporting a legacy execution path.&lt;br /&gt;
&lt;br /&gt;
This approach allows modern development practices while preserving compatibility with older browsers.&lt;br /&gt;
&lt;br /&gt;
== Common Pitfalls ==&lt;br /&gt;
&lt;br /&gt;
=== Assuming Internet Explorer 11 Is the Oldest Browser ===&lt;br /&gt;
&lt;br /&gt;
Many applications continue to run within environments older than Internet Explorer 11.&lt;br /&gt;
&lt;br /&gt;
Support requirements should be determined by actual audience needs rather than assumptions.&lt;br /&gt;
&lt;br /&gt;
=== Depending Entirely on Build Pipelines ===&lt;br /&gt;
&lt;br /&gt;
Build tools can mask compatibility issues.&lt;br /&gt;
&lt;br /&gt;
Developers should understand the code delivered to the browser and the features being relied upon.&lt;br /&gt;
&lt;br /&gt;
=== Using Modern Features Without Fallbacks ===&lt;br /&gt;
&lt;br /&gt;
Features such as:&lt;br /&gt;
&lt;br /&gt;
* Arrow functions&lt;br /&gt;
* Async/await&lt;br /&gt;
* Fetch&lt;br /&gt;
* Promises&lt;br /&gt;
&lt;br /&gt;
may require alternative implementations in older environments.&lt;br /&gt;
&lt;br /&gt;
A fallback strategy should always be considered.&lt;br /&gt;
&lt;br /&gt;
=== Ignoring Non-Browser JavaScript Engines ===&lt;br /&gt;
&lt;br /&gt;
JavaScript executes in a variety of environments beyond mainstream browsers.&lt;br /&gt;
&lt;br /&gt;
Embedded systems, administrative interfaces, and legacy software may use significantly older scripting engines.&lt;br /&gt;
&lt;br /&gt;
== Design and Architecture Considerations ==&lt;br /&gt;
&lt;br /&gt;
When broad compatibility is a requirement, several principles become important.&lt;br /&gt;
&lt;br /&gt;
=== Prioritise Stability ===&lt;br /&gt;
&lt;br /&gt;
Long-term maintainability is often more valuable than adopting the latest language feature.&lt;br /&gt;
&lt;br /&gt;
=== Optimise for Accessibility ===&lt;br /&gt;
&lt;br /&gt;
Accessibility and compatibility frequently complement one another.&lt;br /&gt;
&lt;br /&gt;
Applications that function with limited capabilities are often more robust overall.&lt;br /&gt;
&lt;br /&gt;
=== Keep Dependencies to a Minimum ===&lt;br /&gt;
&lt;br /&gt;
Every additional dependency introduces:&lt;br /&gt;
&lt;br /&gt;
* Complexity&lt;br /&gt;
* Maintenance overhead&lt;br /&gt;
* Potential compatibility concerns&lt;br /&gt;
&lt;br /&gt;
Native browser capabilities should be preferred whenever practical.&lt;br /&gt;
&lt;br /&gt;
=== Understand Your Audience ===&lt;br /&gt;
&lt;br /&gt;
The appropriate level of compatibility depends upon the intended users.&lt;br /&gt;
&lt;br /&gt;
Public-facing websites often benefit from maximum reach, whereas internal applications may have more controlled requirements.&lt;br /&gt;
&lt;br /&gt;
== Practical Rule of Thumb ==&lt;br /&gt;
&lt;br /&gt;
Before introducing any feature, ask:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Can the application still function if this capability is unavailable?&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the answer is yes, the feature can likely be implemented as a progressive enhancement.&lt;br /&gt;
&lt;br /&gt;
If the answer is no, the feature should be carefully evaluated and justified.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Writing JavaScript for everyone is not about rejecting modern JavaScript. It is about recognising that the web serves an extraordinarily diverse range of users, devices, browsers, and software environments.&lt;br /&gt;
&lt;br /&gt;
By using broadly supported language features, implementing feature detection, embracing progressive enhancement, and understanding the historical evolution of browser scripting engines, developers can create applications that remain useful for the widest possible audience.&lt;br /&gt;
&lt;br /&gt;
Compatibility is not a limitation.&lt;br /&gt;
&lt;br /&gt;
It is a design decision.&lt;br /&gt;
&lt;br /&gt;
== Related Topics ==&lt;br /&gt;
&lt;br /&gt;
* [[Progressive Enhancement]]&lt;br /&gt;
* [[Graceful Degradation]]&lt;br /&gt;
* [[Accessibility]]&lt;br /&gt;
* [[HTML Compatibility]]&lt;br /&gt;
* [[Browser Compatibility]]&lt;br /&gt;
* [[ECMAScript]]&lt;br /&gt;
* [[JavaScript Namespaces]]&lt;br /&gt;
* [[ES Modules]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* ECMAScript Language Specification&lt;br /&gt;
* Microsoft JScript Documentation&lt;br /&gt;
* W3C DOM Specifications&lt;br /&gt;
* MDN Web Docs&lt;br /&gt;
* WHATWG HTML Standard&lt;br /&gt;
* Browser Compatibility Data (BCD)&lt;/div&gt;</summary>
		<author><name>Dex</name></author>
	</entry>
</feed>