I know, it can't be done in PHP. That's not exactly what I'm here for. I have a client who would like to redirect people to a polite 'upgrade your browser' page whenever people visit his site (which has been developed in PHP no less). My question here is, how can I make this so that regardless of what URL someone comes in to, it will always run the sniffer prior to loading the actual URL they visited? In other words, whether the visitor comes to the main url (http://www.site.org), or whether they are going to a specific link (http://ww.site.org/seethis/), the client would like the sniffer to check them all.
I know I can stick the whole javascript sniffer into each and every file, but that's just not efficient. Being that this site was created in PHP, I can very easily stick an 'include' in each file to include the javascript piece, however how can I use the results of that javascript piece inside PHP to then do a Header("Location...") type thing? Can I even do that considering that javascript normally goes within the <head>...</head> section, at which point the page headers were already sent, and doing a Location redirection within PHP will only result in an error.
This can be done using PHP, the HTTP_USER_AGENT variable, the get_browser() function, and a browscap.ini file. Check out:
http://www.php.net/manual/en/function.get-browser.php
Make a script that determines the browser being used which redirects if necessary. Include this at the top of every page and voila!
Hope that helps, Larry
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php