SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: Style based on browser
Hybrid View
-
Nov 29, 2001, 21:59 #1
- Join Date
- Jul 2000
- Location
- Somewhere
- Posts
- 81
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Style based on browser
Hi,
How can I get a style sheet to load up based upon browser type?
The site I am currently working on displays as intended in IE6, NS6, and Opera 5. IE5 does not display the site as well and I would like to load up an IE5 specific stylesheet for users of the browser.
Thanks.
-
Nov 29, 2001, 22:37 #2
- Join Date
- Nov 2001
- Location
- Earth
- Posts
- 103
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is your site just HTML or PHP or ASP??
Different methonds depending on how it is coded.
Frankhttp://www.serverexpert.com/ Discuss servers and the software that makes them work.
http://www.webmasters-resources.com/ Resources for webmasters.
-
Nov 29, 2001, 22:48 #3
- Join Date
- Jul 2000
- Location
- Somewhere
- Posts
- 81
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ffeingol,
The site is mostly html, with some php thrown in for file includes.
-
Nov 29, 2001, 22:57 #4
- Join Date
- Nov 2001
- Location
- Earth
- Posts
- 103
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Here is an article from www.phpbuilder.com that gives an example of how to do it with PHP.
It's just one example.
Frankhttp://www.serverexpert.com/ Discuss servers and the software that makes them work.
http://www.webmasters-resources.com/ Resources for webmasters.
-
Nov 30, 2001, 00:40 #5
- Join Date
- Jul 2000
- Location
- Somewhere
- Posts
- 81
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks.
That link was pretty interesting.
While I'm sure I could figure it out (i'm not a php expert yet)I'd like to do something a bit simpler.
Any ideas? Thanks again for your help.
-
Dec 25, 2001, 16:46 #6
- Join Date
- Dec 2001
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
JavaScript
If you're really against doing a browser detection with server-side scripting, you could use JavaScript to do it. Mozilla has a little browser-detection script that you can download at http://www.mozilla.org/docs/web-deve...wser_type.html. You could put a chunk of code that looks something like this in your head tags:
<script lanugage="JavaScript" type="text/css" src="filelocation.js">
<!--
if (is_nav4up || is_ie3up) {
document.write(<link rel="stylesheet" type="text/css" href="somefile.css">);
else {
document.write(<link rel="stylesheet" type="text/css" href="someotherfile.css">);
}
// Hide from older browsers -->
</script>
Please forgive any errors as I am not very experienced in using JavaScript.
Hope this helps and good luck!
-
Dec 26, 2001, 17:19 #7
- Join Date
- Dec 2001
- Location
- San Diego, CA
- Posts
- 617
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I know ESPN.COM uses this. Check their code to see how they did it. I always learn by looking at others code.
EDIT: actually, don't look at their code, it's chaos, hah
-
Dec 26, 2001, 20:39 #8
Browser-sniffing methods are always going to be inherently flawed. Most modern browsers give users the option of spoofing their user-agent header, which would completly screw up and sniffer code. Also if you dont have Javascript enabled then a Jscript sniffer wont work at all.....
THE INSTRUCTIONS BELOW ARE OLD AND MAY BE INACCURATE.
THIS INSTALL METHOD IS NOT RECOMMENDED, IT MAY RUN
OVER YOUR DOG. <-- MediaWiki installation guide
Bookmarks