|
| |
|
|
BobbyDouglas
Posts: 5479 Joined: 5/15/2003 From: Arizona Status: offline
|
Display Code Based on Browser - 6/6/2005 17:11:27
For those people who use certain hacks for browsers, such as the IE min/max hack, then this is something you will want to implement! Why have a FireFox user load hacks that are only for IE? I see no reason. The two main uses for this are for JavaScript for IE only, or the MSSmartTagsPreventParsing for IE as well. Here is an example of code used to display these IE only attributes when the browser is IE. Place this at the beginning of your document. If you wish to make it an include, it will be easier in the long run if you decide to add more browsers to the list: <?php
$is_ie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE');
?> Example code using the MSSmartTagsPreventParsing for IE only. <?php
if ($is_ie) echo "<meta name=\"MSSmartTagsPreventParsing\" content=\"true\" />
";
?> Be sure to change each " to a \" when you place your code between echo "you-code-goes-here" <meta name=\"MSSmartTagsPreventParsing\" content=\"true\" /> will only display in the source code when the browser is IE. This is a tag that only IE uses, so there is no reason for someone to display it in all of the browsers. Note that this code only runs on PHP pages, if you are not sure if it will work on your hosting account, please ask your host.
_____________________________
Arizona Web Design - Mr Bobs Web Design in Arizona The Arizona Web Hosting Challenge
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|