Forum Moderators: open

Message Too Old, No Replies

Adding tag to CSS for older browsers not supported

         

Compworld

6:45 am on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Where can I find the code to enter in my CSS file to let my customers that our site only accepts I.E. and Netscape browsers of 5.0 and higher?

Thanks,

CompWorld

hartlandcat

6:57 pm on Sep 6, 2003 (gmt 0)

10+ Year Member



You do that with JavaScript, not CSS.

Blocking certain browsers is the last thing you want to do. Okay, re-direct older browsers to a page that suggests that they upgrade (i.e. provide download links) but don't force them to upgrade. Always make continuing through to the site an option.

So, we want to block all non IE and Netscape browsers, do we? What about Opera, Konqueror and Safari? I'm sure they are more than capable of displaying your site correctly.

P.S. There is no such thing as Netscape 5.0

g1smd

10:25 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Write your CSS for the newer browsers, then put the CSS in an external .css file.

Link to the file using:

<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">@import url(styles.css);</style>

and older browsers will not "see" the CSS.

This gives older browsers unstyled content, rather than crashing their machines with CSS that they cannot handle. For those older machines, they will find your site to be faster than many others, as they will simply be taking only the (lean) HTML code, page content, and the images, with no style information at all.

choster

12:29 am on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use either or both of these methods if you still need to create the message. For instance, put

<p id="unsupported">
Sorry, your web browser is not supported by this site. Content may not appear as it was intended. Some functionality may be limited or disabled. You can <a href="getnewbrowser.html">update your brower</a> or continue below.
</p>

wherever it's intended to go. To block just Netscape 4 and earlier browsers, you then use the @import directive, you load a second stylesheet containing the line #unsupported {display: none}, which turns off the message in IE5+ and NN6+ and compatible browsers.

And please, no redirects and no lectures. Many of us don't have control over what browsers we use at work or school. An upgrade link is useless to us. We know we're not using the latest and greatest. You're telling someone in a wheelchair that the subway wouldn't be so crowded if he would just stand up. I'm on your site for the content, not the design, so why not let me at least attempt to view it?

The place to put your warning is wherever you require advanced Javascript, or perhaps on a page for a secure form that requires a browser with upgraded security.