Alternative to JavaScript

On 3 min, 16 sec read

HTML noscript tag

Most browsers allow users to disable JavaScript. Some browsers for simple devices or older computers do not support JavaScript. Site owners can use the noscript tag to provide content to all visitors.

Everything that is surrounded by the noscript tags will only be displayed if JavaScript is disabled or not supported by the browser.

This tutorial uses the HTML noscript tag. The noscript tag can be used to provide alternate content for users without JavaScript.

    Tools are required:

  • Text editor.
  • HTML.
  • JavaScript.
  • Browser to view output.

Optional Download and install suitable text editor

Any text editor with regular expression support will work. To select a reviewed lightweight programming editor read the Ojambo.com Lightweight Programming Editors.

No Script Usage

JavaScript Noscript
<script type=”text/Javascript”>
document.write(“JavaScript is supported!”);
</script>
<noscript>
JavaScript is not supported!
</noscript>

JavaScript will output the statement “JavaScript is supported!”. If JavaScript is disabled or not supported, the noscript tag will output “JavaScript is not supported!.”

Noscript.html file




&lt;!--
	Noscript.html

	Copyright 2011 Edward &lt;http://ojambo.com&gt;

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
	MA 02110-1301, USA.
        
        
--&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
	&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;

&lt;head&gt;
	&lt;title&gt;Ojambo.com Noscript Tutorial&lt;/title&gt;
	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=utf-8&quot; /&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;h1&gt;Ojambo.com Noscript Tutorial&lt;/h1&gt;
		
	&lt;script type=&quot;text/javascript&quot;&gt;
		// Content to display if Javascript is enabled
		document.write(&quot;JavaScript is supported!&quot;);
	&lt;/script&gt;
	
	&lt;noscript&gt;
		&lt;!-- Content to display if JavaScript is disabled --&gt;
		JavaScript is not supported!
	&lt;/noscript&gt;
&lt;/body&gt;

&lt;/html&gt;

The noscript tag can be above the script tag since it will only be displayed if JavaScript is not working.

How to Use:

Run the Noscript.html file in your favourite browser.
Disable JavaScript in your browser and refresh the page.
Enable JavaScript in your browser and refresh the page.

Demonstration:

Ojambo.com Noscript Tutorial


Conclusion:

HTML noscript tags can be used to display alternate content when JavaScript is not available. Instead of displaying content in a different way, most programmers prefer to warn visitors that JavaScript is disabled.

    Recommendations:

  1. Do not assume that users simple disabled JavaScript.
  2. If the website is JavaScript-heavy, a “noscript” warning is appropriate.
  3. As great as JavaScript is, do not assume users want to load several scripts.
  4. Reuse as much JavaScript as possible to keep optimal loading times.

🚀 Recommended Resources


Disclosure: Some of the links above are referral links. I may earn a commission if you make a purchase at no extra cost to you.

About Edward

Edward is a software engineer, author, and designer dedicated to providing the actionable blueprints and real-world tools needed to navigate a shifting economic landscape.

With a provocative focus on the evolution of technology—boldly declaring that “programming is dead”—Edward’s latest work, The Recession Business Blueprint, serves as a strategic guide for modern entrepreneurship. His bibliography also includes Mastering Blender Python API and The Algorithmic Serpent.

Beyond the page, Edward produces open-source tool review videos and provides practical resources for the “build it yourself” movement.

📚 Explore His Books – Visit the Book Shop to grab your copies today.

💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.

🔨 Build it Yourself – Download Free Plans for Backyard Structures, Small Living, and Woodworking.