View Full Version : Help-Prevent page from loading if java is not enabled

05-27-2009, 12:28 PM
Hi all,

Is there any method which blocks the website from loading, if the browser using is not java script enabled? I have a webpage with some details to be entered. This website is designed in such a way that it checks the exceptions in the entry and alerts the user regarding it which is done using javascript. but for some users this feature is not working. I guess its the problem with the browser they use. So how can I alert them to enable Java by adding something to the script? Is there any way which prevents the page from loading if java is not enabled in the browser? It would be a great help if some one can help in this.

05-27-2009, 01:07 PM
First at all, make yourself clear. Are you talking about Java? Or Javascript? They are different languages.

05-27-2009, 01:27 PM
I just want to alert the user if his browser does not support javascript and also alert him if it is not enabled.

Philip M
05-27-2009, 01:50 PM
If Javascript is not enabled, then you cannot run a script to find out if Javascript is enabled or not.

The best you can do is use a <NOSCRIPT> tag. The <NOSCRIPT> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a (ancient?) browser that doesn’t support client-side scripting. The content inside the noscript element will only be displayed if scripts are not supported, or are disabled in the user’s browser.

<script type="text/javascript">
document.write("Hello World!")
<noscript>Your browser does not support JavaScript or it is not enabled!</noscript>

Note that you cannot use an alert which is Javascript which is disabled!