How to determine the browser of the user using PHP?
So that if the users browser is IE then the variable $alert="onbeforeunload" and if it is not IE, for example Firefox (else) then $alert="onload.
Help is much appreciated.
Thanks
Also please note that I can not install browscap.ini on my PHP server.
See if this code works for you
<?php
function detect_ie(){
return (sizeof(explode("MSIE",$_SERVER['HTTP_USER_AGENT'])) > 1);
}
if (detect_ie())
$event = "onbeforeunload";
else
$event = "onload";
?>