Hi people,

I think is the PHP scripter needs to know in advance if he can count on Client-side scripting capability.
I just start with PHP but wrote this chunk of code to check it.


<?php
if (isset($_REQUEST['UA_js'])) {
session_start();
$_SESSION['UA_js'] = $_REQUEST['UA_js'];
if ($_SESSION['UA_js'] == 'true') {
$_SESSION['UA_coky'] = $_REQUEST['UA_coky'];
... add more vars
}
header( "Location: http://mydomain.com/secondPage.php"; );
exit;
}
?>
<html>
<head>
<noscript>
<meta http-equiv="Refresh" content="0; URL=<?php echo $_SERVER['PHP_SELF'];?>?UA_js=false" />
</noscript>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="hidden" name="UA_js" value="true" />
<input type="hidden" name="UA_coky" value="" />
... add more hidden fields
</form>
<script type="text/javascript">
UA_form = document.forms[0];
UA_form['UA_coky'].value = navigator.cookieEnabled;
... set more values
UA_form.submit();
</script>
</body>
</html>


Then you can send the client the page tailored for him and to know in advance what can you expect from him.
It would be nice if the browser sent in the request a flag about this funcionality.
Sure this code can be improved (I'd love ideas about it) but think the knowledge of what's exactly is in the other side will pay the extra process.


Sorry about my english

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to