javascript detection with php

A

Anonymous

Guest
Hello ,

I have a problem . I need to write some line of php code to detect if the browser is able to run javascript . If it is not able to run javascript it should stop , exit(); , while if the browser is able to run javascript , the php script should must continue .

Any idea ?
Thanks a lot .
 
PHP is server side.
Javascript is client side.

So it's not like php "knows" if the client is javascript-capable.

You probably need to make a page wich is displayed first. In this page you got some javascript wich forwards the user to the page wich was specificly made for/with javascript. If the user has no javascript, he will not be forwarded (javascript can't do that, because he hasn't got it :))

Does this make sence? It does to me.
But then again, I don't use ANY javascript myself, only "plain" html, I've yet to find something for wich I need it.

Greetz Daan
 
Hello ,

thanks for reply .

Since I cannot use php header fuction to redirect (it gives me an error , ,headers are already opened , and at this time I cannot fix it ) I need to use a javascript meta refresh like this ;

echo "<meta http-equiv=\"REFRESH\" content=0;URL=anonymous_set.php?check=$check&allowanonftp=$allowanonftp&allowanonftpin=$allowanonftpin>";

If the user stops javascript on his browser , he can get the url with the session id , and could insert custom variables and it's not good for me .

So , before executing the echo above , i need to stop the php code if javascript has been disabled on the browser .... any idea ?
 
I am trying this now ......

<HTML>
<HEAD>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
if (navigator.javaEnabled() == true) {
var javatest = "yes";
document.write(javatest,"<p>")
}
</SCRIPT>
<?php
echo $javatest;
?>
</body>
</HTML>

But echo $javatest; is returning nothing . Any idea ?
 
Back
Top