by Hiroshi on August 4th, 2008
Use this simple test for checking or detecting user’s browser information.
<?php // browser test if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) { echo 'You are using Internet Explorer.<br /> Get FireFox for better browsing.<br />'; } else { echo 'You are <strong>NOT</strong> using Internet Explorer.<br /> Good for you.<br />'; } ?> <?php // for browser info echo $_SERVER['HTTP_USER_AGENT']; ?>
Or simply.
<?php // browser test if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) { ?>
<div class="firefox"> Oyi...! Internet Explorer's dangerous... Get Firefox for safe and fast browsing... <a href="link">Click heya to get the FF</a> </div>
<? } ?>
You can put this css in head section of web page for warning message. And put above php script at the top of all your web page content.
<style type="text/css"> <!-- .firefox { font: 11px Verdana, Arial, Helvetica, sans-serif; color: #666666; text-decoration: none; background: #f8eada; display: block; padding: 2px; width: 100%; overflow: visible; position: fixed; visibility: visible; text-align: center; margin-bottom: 10px; vertical-align: middle; border-bottom: 1px solid #f2d9bd; } body { margin: 0px; padding: 0px; font: 11px Verdana, Arial, Helvetica, sans-serif; color: #666666; text-decoration: none; } .firefox a { font: 11px Verdana, Arial, Helvetica, sans-serif; color: #ff6600; text-decoration: none; } .firefox a:hover { font: 11px Verdana, Arial, Helvetica, sans-serif; color: #000000; text-decoration: none; } --> </style>
browser, Checks, Explorer, PHP Basics, php scripts, Security, warning
One Review
Leave a Review
Incoming Searches
php check browser, php browser check, browsercheck php, php detect browser echo, php class browser checker, php check browser firefox, php browsercheck, How to put browser info in a webpage, freeware script browsercheck, checking user browser php, checking user browser in php, check the browser type in php, check browser php, browsercheck php script, php how to check browser



nice little tips, thanks for sharing.