<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: load different stylesheet based on browser</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/</link>
	<description></description>
	<pubDate>Wed, 27 Aug 2008 23:37:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Bjorn</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7513</link>
		<dc:creator>Bjorn</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7513</guid>
		<description>This link is helpfull for me.
http://www.digiways.com/articles/php/dyncss/
</description>
		<content:encoded><![CDATA[<p>This link is helpfull for me.<br />
<a href="http://www.digiways.com/articles/php/dyncss/" rel="nofollow">http://www.digiways.com/articles/php/dyncss/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johno</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7511</link>
		<dc:creator>Johno</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7511</guid>
		<description>How can I get my page to load a different CSS file for the Opera browser?</description>
		<content:encoded><![CDATA[<p>How can I get my page to load a different CSS file for the Opera browser?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jennifer</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7512</link>
		<dc:creator>Jennifer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7512</guid>
		<description>&lt;a href="http://www.javascriptkit.com/javatutors/navigator.shtml" target="_blank"&gt;Here's a link I just found&lt;/a&gt; that might be helpful:</description>
		<content:encoded><![CDATA[<p><a href="http://www.javascriptkit.com/javatutors/navigator.shtml" target="_blank">Here&#8217;s a link I just found</a> that might be helpful:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7510</link>
		<dc:creator>Philip</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7510</guid>
		<description>Sorry. I got confused. Here's the entire message I meant to send:

Hi goddess,
I've been working out a clean, simple, javascript-free way of doing this and thought I'd share my approach:

1) In your document head, put this:
&#60;link rel='stylesheet' type='text/css' media='screen' href='styles.css' /&#62;
&#60;script type='text/javascript' src='nn4.js'&#62;&#60;/script&#62;

2) Make a new file 'nn4.js' and add this:
if (document.layers) { 
document.write('&#60;link rel="stylesheet" type="text&#92;/css" href="nn4.css" &#92;/&#62;');
document.write(''&#60;script type="text&#92;/javascript"&#62;');
document.write('origWidth = innerWidth;');
document.write('origHeight = innerHeight;');
document.write('function reload() { if (innerWidth != origWidth &#124;&#124; innerHeight != origHeight) location.reload(); }');
document.write('onResize = reload;');
document.write(''&#60;&#92;/script&#62;');
}

Then create your Netscape4-friendly stylesheet and save it as 'nn4.css'. I put this in a .js file for two reasons: 1- NN4 doesn't load styles unless javascript is on and 2- the reload-on-resize script is necessary whenever you use absolutely positioned divs in NN4.

3) Create a 'styles.css' file and put this in it:
@import url(styles0.css); /* for v4 browsers */
@import url("styles1.css"); /* for v5 */
@import "null?&#92;"&#92;{"; 
@import url("styles2.css"); /* for v6+ and MacIE5+ */

What you've got here is a string that screens out buggy browsers. Now, you don't HAVE to make this many variations of your stylesheet. If you create a single stylesheet for all version 4 AND 5 browsers, you can delete the second line.

Let me know what you think.

p.s. create an empty file called 'null' (with no extension) if you want your stylesheets to validate.</description>
		<content:encoded><![CDATA[<p>Sorry. I got confused. Here&#8217;s the entire message I meant to send:</p>
<p>Hi goddess,<br />
I&#8217;ve been working out a clean, simple, javascript-free way of doing this and thought I&#8217;d share my approach:</p>
<p>1) In your document head, put this:<br />
&lt;link rel=&#8217;stylesheet&#8217; type=&#8217;text/css&#8217; media=&#8217;screen&#8217; href=&#8217;styles.css&#8217; /&gt;<br />
&lt;script type=&#8217;text/javascript&#8217; src=&#8217;nn4.js&#8217;&gt;&lt;/script&gt;</p>
<p>2) Make a new file &#8216;nn4.js&#8217; and add this:<br />
if (document.layers) {<br />
document.write(&#8217;&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text&#92;/css&#8221; href=&#8221;nn4.css&#8221; &#92;/&gt;&#8217;);<br />
document.write(&#8221;&lt;script type=&#8221;text&#92;/javascript&#8221;&gt;&#8217;);<br />
document.write(&#8217;origWidth = innerWidth;&#8217;);<br />
document.write(&#8217;origHeight = innerHeight;&#8217;);<br />
document.write(&#8217;function reload() { if (innerWidth != origWidth || innerHeight != origHeight) location.reload(); }&#8217;);<br />
document.write(&#8217;onResize = reload;&#8217;);<br />
document.write(&#8221;&lt;&#92;/script&gt;&#8217;);<br />
}</p>
<p>Then create your Netscape4-friendly stylesheet and save it as &#8216;nn4.css&#8217;. I put this in a .js file for two reasons: 1- NN4 doesn&#8217;t load styles unless javascript is on and 2- the reload-on-resize script is necessary whenever you use absolutely positioned divs in NN4.</p>
<p>3) Create a &#8217;styles.css&#8217; file and put this in it:<br />
@import url(styles0.css); /* for v4 browsers */<br />
@import url(&#8221;styles1.css&#8221;); /* for v5 */<br />
@import &#8220;null?&#92;&#8221;&#92;{&#8221;;<br />
@import url(&#8221;styles2.css&#8221;); /* for v6+ and MacIE5+ */</p>
<p>What you&#8217;ve got here is a string that screens out buggy browsers. Now, you don&#8217;t HAVE to make this many variations of your stylesheet. If you create a single stylesheet for all version 4 AND 5 browsers, you can delete the second line.</p>
<p>Let me know what you think.</p>
<p>p.s. create an empty file called &#8216;null&#8217; (with no extension) if you want your stylesheets to validate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7508</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7508</guid>
		<description>&lt;a href="http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html"&gt;Try this&lt;/a&gt;.. scroll down to "JAVASCRIPT CODE TO DETECT BROWSER VENDOR, VERSION, AND OPERATING SYSTEM"</description>
		<content:encoded><![CDATA[<p><a href="http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html">Try this</a>.. scroll down to &#8220;JAVASCRIPT CODE TO DETECT BROWSER VENDOR, VERSION, AND OPERATING SYSTEM&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7509</link>
		<dc:creator>Philip</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7509</guid>
		<description>Um, your preview button just posted my comment. Let me continue:

3) Create a 'styles.css' file and put this in it:
@import url(styles0.css); /* for v4 browsers */
@import url("styles1.css"); /* for v5 */
@import "null?&#92;"&#92;{"; 
@import url("styles2.css"); /* for v6+ and MacIE5+ */

What you've got here is a string that screens out buggy browsers. Now, you don't HAVE to make this many variations of your stylesheet. If you create a single stylesheet for all version 4 AND 5 browsers, you can delete the second line.

Let me know what you think.</description>
		<content:encoded><![CDATA[<p>Um, your preview button just posted my comment. Let me continue:</p>
<p>3) Create a &#8217;styles.css&#8217; file and put this in it:<br />
@import url(styles0.css); /* for v4 browsers */<br />
@import url(&#8221;styles1.css&#8221;); /* for v5 */<br />
@import &#8220;null?&#92;&#8221;&#92;{&#8221;;<br />
@import url(&#8221;styles2.css&#8221;); /* for v6+ and MacIE5+ */</p>
<p>What you&#8217;ve got here is a string that screens out buggy browsers. Now, you don&#8217;t HAVE to make this many variations of your stylesheet. If you create a single stylesheet for all version 4 AND 5 browsers, you can delete the second line.</p>
<p>Let me know what you think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laughing Muse</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7507</link>
		<dc:creator>Laughing Muse</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7507</guid>
		<description>Does anyone know what variable Javascript uses to designate the operating system? I know that the browser.name can be set to find out the browser, and perform actions based on that; but I need to know how Javascript recognises the operating system.</description>
		<content:encoded><![CDATA[<p>Does anyone know what variable Javascript uses to designate the operating system? I know that the browser.name can be set to find out the browser, and perform actions based on that; but I need to know how Javascript recognises the operating system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7504</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7504</guid>
		<description>Jennifer, I wouldn't know if php would work on a page with this ssi script.

BTW: could you please make Geneva the first font in your css? It is a Mac screen font that works best (this site doesn't look so hot).  Thanks.</description>
		<content:encoded><![CDATA[<p>Jennifer, I wouldn&#8217;t know if php would work on a page with this ssi script.</p>
<p>BTW: could you please make Geneva the first font in your css? It is a Mac screen font that works best (this site doesn&#8217;t look so hot).  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laughing Muse</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7505</link>
		<dc:creator>Laughing Muse</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7505</guid>
		<description>Is there a way in Javascript to specify the OS? My switching code is much less ornate, and serves up a stylesheet based only on OS and browser type (one for MSIE/Windows, another for non-MSIE/non-Windows [ie, Netscape and Opera on the Mac], and a third for anything else), but I can't find what Javascript variable name to use to specify the operating system. All HTML pages use the switching code, but any page that is displayed via a Perl script cannot.

I know PHP is your forte; but folks seem to have a lot of knowledge about different scripting languages. Can anyone help me out on this one?</description>
		<content:encoded><![CDATA[<p>Is there a way in Javascript to specify the OS? My switching code is much less ornate, and serves up a stylesheet based only on OS and browser type (one for MSIE/Windows, another for non-MSIE/non-Windows [ie, Netscape and Opera on the Mac], and a third for anything else), but I can&#8217;t find what Javascript variable name to use to specify the operating system. All HTML pages use the switching code, but any page that is displayed via a Perl script cannot.</p>
<p>I know PHP is your forte; but folks seem to have a lot of knowledge about different scripting languages. Can anyone help me out on this one?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lynda</title>
		<link>http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7506</link>
		<dc:creator>Lynda</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2002/06/28/load-different-stylesheet-based-on-browser/#comment-7506</guid>
		<description>I found &lt;a href="http://www.php.net/tut.php"&gt;this page&lt;/a&gt; at php.net pretty useful.  You can extract whatever info you want from http_user_agent and echo a stylesheet line accordingly (but you'd need to know how everything displayed in http_user_agent).

I found I'm going to have to use this because IE 5.5 displays my stylesheet wacky, while the rest of the current browsers view it fine...  here's the code I'm using:

&lt;h3&gt;&#60;?php
if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE 5.5")) {
echo '&#60;link rel="stylesheet" type="text/css" href="/layout/css/common_ie5.css" /&#62;';
} else {
echo '&#60;link rel="stylesheet" type="text/css" href="/layout/css/common.css" /&#62;';
}
?&#62;&lt;/h3&gt;</description>
		<content:encoded><![CDATA[<p>I found <a href="http://www.php.net/tut.php">this page</a> at php.net pretty useful.  You can extract whatever info you want from http_user_agent and echo a stylesheet line accordingly (but you&#8217;d need to know how everything displayed in http_user_agent).</p>
<p>I found I&#8217;m going to have to use this because IE 5.5 displays my stylesheet wacky, while the rest of the current browsers view it fine&#8230;  here&#8217;s the code I&#8217;m using:</p>
<h3>&lt;?php<br />
if (strstr($_SERVER["HTTP_USER_AGENT"], &#8220;MSIE 5.5&#8243;)) {<br />
echo &#8216;&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/layout/css/common_ie5.css&#8221; /&gt;&#8217;;<br />
} else {<br />
echo &#8216;&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/layout/css/common.css&#8221; /&gt;&#8217;;<br />
}<br />
?&gt;</h3>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.303 seconds -->
