Re: Newbie NN4 help...
| From: | Kevin Stone | Date: | Fri, 18 Oct 2002 20:22:02 +0000 |
| Subject: | Re: Newbie NN4 help... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120561@lists.php.net to get a copy of this message | ||
Well one option is obvious.. stop coding for legacy browsers. The company I
work for recently decided to stop developing for anything older than NN6 and
IE5. It is no longer cost effective for us to spend time developing for the
other browsers. Okay so this may not be an option for you but it is
something that I highly recommend you consider.
Fortunately there is a fix to your problem and that is not to rely on
Cookies. Many programmers have noted a number of incompatibilities and bugs
with Cookies and legacy browsers which seem to change on a per-installation
basis. You can instead use the $HTTP_USER_AGENT environment variable to
cloak the style sheet.
For example here's the $HTTP_USER_AGENT for Netscape 7.0 on Windows..
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1)
Gecko/20020823 Netscape/7.0
And for Internet Explorer 6.0 on Windows...
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
You can preg_match() for the indicators and write a function that cloaks
your CSS file. Something like this..
-----------------
<?
function css_cloak ($useragent)
{
if (preg_match("/Netscape\/4/i", $useragent))
return "legacy.css";
else
return "modern.css";
}
echo "<link href=\"".css_cloak($HTTP_USER_AGENT)."\"
rel=\"stylesheet\"
type=\"text/css\">";
?>
------------------
Note I really don't know exactly what indicators are in the $HTTP_USER_AGENT
for Netscape 4.0 but this should do the trick. Good luck!
-Kevin
----- Original Message -----
From: "Stephanie Sullivan" <design@violetsky.net>
To: <php-general@lists.php.net>
Sent: Friday, October 18, 2002 1:49 PM
Subject: [PHP] Newbie NN4 help...
> Hi people... I've just used PHP for the first time... It's being used as a
> CSS-style switcher (my client didn't want to use a javascript client-side
> solution)... I have it all working well in most browsers I've tried it
in...
> EXCEPT the dreaded NN4* ... This script uses a cookie... And then switches
> the styles... Is there something I don't know about that would cause NN4
to
> be unable to use this?
>
> I'm rather at a loss and my site is two days over deadline... :( If anyone
> could point me in the right direction I'd be VERY appreciative...
>
> The page I'm playing with is here:
> http://www.kspope.com/phpswitch/test6.php
>
> The switcher is at the bottom of the page... And it reloads the NN page,
but
> doesn't change it. (Don't mind the NN "mess" I"m working on the
> styling
for
> that browser right now)...
>
> Thank in advance for any input... :)
>
> Stephanie Sullivan
> VioletSky Design
> http://www.violetsky.net
>
> ³I am always doing that which I can not do, in order that I may learn how
to
> do it." -Picasso
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>