What's Here?
- Members: 244,059
- Replies: 692,830
- Topics: 113,100
- Snippets: 3,863
- Tutorials: 935
- Total Online: 1,403
- Members: 90
- Guests: 1,313
|
custom tag used to load css based on screen resolution, operating system, and browser
|
Submitted By: wiredwizard
|
|
|
Rating:
|
|
Views: 1,400 |
Language: ColdFusion
|
|
Last Modified: May 7, 2005 |
Instructions: will need style sheet for all of following
ie 800x600 = global.css
ie 1024 = globallg.css
netscape 800 = nglobal.css
and so forth |
Snippet
<script language="JavaScript" type="text/JavaScript">
var screen_width = screen.width;
var myflag = false
if(navigator.appName == "Microsoft Internet Explorer" && screen_width <= 800 && navigator.appVersion.indexOf("Win")!=-1) {
document.write("<link href=\"global.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Microsoft Internet Explorer" && screen_width >= 1024 && navigator.appVersion.indexOf("Win")!=-1) {
document.write("<link href=\"globalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Netscape" && screen_width <= 824 && navigator.appVersion.indexOf("Win")!=-1) {
document.write("<link href=\"nglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Netscape" && screen_width >= 1024 && navigator.appVersion.indexOf("Win")!=-1) {
document.write("<link href=\"nglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Microsoft Internet Explorer" && screen_width <= 820 && navigator.appVersion.indexOf("Mac")!=-1) {
document.write("<link href=\"macglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Microsoft Internet Explorer" && screen_width >= 1024 && navigator.appVersion.indexOf("Mac")!=-1) {
document.write("<link href=\"macglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Netscape" && screen_width <= 824 && navigator.appVersion.indexOf("Mac")!=-1) {
document.write("<link href=\"macnglobal.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if(navigator.appName == "Netscape" && screen_width >= 1024 && navigator.appVersion.indexOf("Mac")!=-1) {
document.write("<link href=\"macnglobalLg.css\" rel=\"stylesheet\" type=\"text/css\" />");
myflag = true;
}
if (myflag == false) {
document.write("<link href=\"global.css\" rel=\"stylesheet\" type=\"text/css\" />");
}
</script>
Copy & Paste
|
|
|
Be Social
Programming
Web Development
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|