Saturday, August 27, 2011

to solve javascript disable browser

If you use javascript code for your application, you should not depend fully on it for various important checking. Beside it, server side checking also should be implemented. Because, if javascript of the web browser is disabled then, all checking will be stopped with it.

But, there is an another option of the disabling problem of javascript. There is a tag <NOSCRIPT>, which is use when javascript is not found in the browser. And message can be showed inside this <NOSCRIPT> tag. Beside showing message it can also be used to hide a page element from the page. An example of code snap of using <NOSCRIPT> tag. <NOSCRIPT> tag should be used inside <HEAD> tag

Code Example of NOSCRIPT


<noscript >
<style type="text/css">
.pagecontainer {display:none;}
</style>
<div style="color: red; text-decoration: blink;font-size: xx-large" align="center">
This page uses Javascript. Your browser either doesn't support Javascript or you have it turned off.
To see this page as it is meant to appear please use a Javascript enabled browser
</div>
</noscript>

No comments: