JavaScript > Placing JavaScript code

Browser support for JavaScript in JavaScript

How to prevent JavaScript tag showing up in case a browser doesn’t support JavaScript?


To handle the scenario where your page runs on the browser that doesn’t support JavaScript, you should write your code something like below.

<script>
<!--
document.write("<b>Hello world using JavaScript!</b>");
//-->
</script>

If you will not wrap the code inside <!-- and //-->, browser that doesn’t support JavaScript shall display the raw JavaScript code in the html page as output.

 Views: 4888 | Post Order: 6



Write for us






Hosting Recommendations