Hi, can anyone help me in trying to check whether JavaScript is enabled in client browser using Java code.
Thanks in advance
Hi, can anyone help me in trying to check whether JavaScript is enabled in client browser using Java code.
Thanks in advance
A simple thing would be to do a call back from the page, such as an AJAX call. I don't think there's any other way to determine this, at least not universally.
Are you trying to do this server-side or on the client in an applet?
If a browser does not support javascript (or has it turned off), it's highly unlikely they will have support for Java applets.
If a form submit is performed, you can put a hidden input in the form and fill out its value with javascript (from OnSubmit) and check that on the server side.
In yourform for you can put code like this:
<noscript>
<input type="hidden" name="JavaScript" value="false" />
</noscript>
The parameter should only be submitted if the browser has scripts turned off. In your Java applications you can check it like so:
boolean javaScript = request.getParameter("JavaScript") == null;
If you have PHP support just copy and paste the code below.
<noscript>
<input type="hidden" name="JavaScript" value="false" />
</noscript>
/*This code is developed by Lankeshwer(nick name only) and can be used as open source by anyone*/
<?PHP
if($_POST['JavaScript']!='false'){
echo "<run your javascript code here>";} //replace this line with your actual javascript code
else
echo "<html><head><meta http-equiv="refresh" content="0;url=www.kharida.com"></head</html>";
?>
wish you a good luck and don't forget to make your code open