Forum Moderators: open
Problem is, the pop-up immediately gets covered by a Windows system message saying "Netscape has performed an illegal action and will be shut down" -- so I can't read the whole message, and I can't get to the Netscape code, because of the browser sniffer. I'd love to know what they're doing, so I can avoid doing it myself. Crashing a browser used by 10% of my visitors is not a good idea.
But I do really like those colored text form inputs. Classy.
I just spent the night looking through PHP tutorials, and after wondering about the potential functionality of some little PHP "browser sniffing" routine, I run into this thread first thing.
What is fascinating is not only does PHP lend itself to structured/modular logic, but it can be inspersed right on the web pages, right in there with the HTML code, and still process server side. Fascinating!
This has got my bells ringing - but I have not ever seen PHP used this way, even though it can be done.
Anyone seen it in actual usage, or actually used it?
echo "Your browser is: $HTTP_USER_AGENT<br><br>\n";
// browser detection
// MSIE 4 or 5?
if(eregi("msie.[4¦5]",$HTTP_USER_AGENT))
$browser = "msie";
// Netscape Navigator?
else if(eregi("nav",$HTTP_USER_AGENT))
$browser = "nav";
else
$browser = "other";
// select which stylesheet to use
if($browser == "msie")
// is it almost christmas?
if(date("z") > 350)
{
echo "It is almost Christmas<br><br>\n";
echo "phtml.com uses /css/msiexmas.css for your browser<br><br>\n";
}
else
{
echo "phtml.com uses /css/msie.css for your browser<br><br>\n";
}
else
{
// is it almost christmas?
if(date("z") > 350)
{
echo "It is almost Christmas<br><br>\n";
echo "phtml.com uses /css/otherxmas.css for your browser<br><br>\n";
}
else
{
echo "phtml.com uses /css/other.css for your browser<br><br>\n";
}
}
// select which bookmark code to display
echo "and uses this bookmark code:<br>\n";
if($browser == "msie")
{
echo "<span style='color:blue;cursor:hand;'
onclick='window.external.AddFavorite(\"http://phtml.com/\", \"phtml.com - Free PHP Scripts\");'>Click here to bookmark phtml.com</span>";
}
elseif($browser == "nav")
echo "Bookmark phtml.com (Press CTRL+D)";
else
echo "Don't forget to bookmark phtml.com";
?>
This site could be done in such way that it supports 3rd generation browsers and everything thereafter. However, the fact that it's meant for developers allows us to assume and expect that you are up to date. This fact, made the building of the site a more enjoyable experience instead of a "compatibility adventure" that a commercial site has to face.
--
Which looks identicle to what IE is putting out sans the popup.
"Don't try to impress your visitors with rollovers. Everyone can make them and they end up being a waste of bandwidth. If they still impress you, you were probably in a cave the last 2 year."
I agree that rollovers are pretty common and nothing to be proud of producing, but the simple fact is visitors still appreciate a bit of interactivity on the page.
A bit snobbish!
I have implemented this and also have included the "textarea" field and the "option" field in my forms.
If you do not include them, they will stay "white".
Here is the full css I used:
input {background-color: #6699FF}
textarea {background-color: #6699FF}
option {background-color: #6699FF}
It works great! Of course, it does not work for Netscape... but does for IE.
Nice find BoneHeadicus!