Validating JavaScript

hello readers… sorry that i have not been blogging recently. I have been caught on a few project works and are occupied most of the time.. anyways lets continue 🙂

this hack is just a simple hack, dosent require any heavy coding, just good old plain HTML. If we had to validate that the browser is javascipt enabled, we have to run some code to test it out… there are many codes available on the net to do this. But im gonna show u a simple approach that many developers fails to relaise that exist 🙂

The <noscript>, noscript element is used to define an alternate content (text) if a script is NOT executed. This tag is used for browsers that recognizes the <script> tag, but does not support the script in it. If a browser supports scripting, it will not display the text in the noscript element.


<strong>This example requires a JavaScript-enabled browser!<br/><br/></strong>

// this is a sample javascript to test if the <noscript> tag works
alert(“test! Hey it works”);

In the above example the text between the <noscript> tag is displayed only when the browser’s javascipt is disabled.

And when u have a Javascipt enabled, the text between the <noscript> tag will not be displayed and the javascript code will be executed.

hmmmm simple isnt it, no much of hardwork to do eh’ 🙂 no u can do this simple validation easily without much os a hassle.. hope this will help alot of people…

well anyhoo, ciao till next time…


About this entry