Ryan Rich
Ryan Rich

Reputation: 12055

Can't detect IE

I'm currently revamping a website for a local bank. Most of their customers are working with IE. I've used standards I thought were compatible with IE7 but it's absolutely shredding it apart. Surprisingly it looks a touch better in IE6. I've been trying to run a script to detect this. Many of which I have found on here.

i.e.

if($.browser.msie && $.browser.version=="6.0") alert("Please update your version of IE");

and

<!--[if IE 6]>

Content for IE 6

<![if !IE 6]>

Content not for IE

and I've also tried some style switching

 <!--[if (gte IE 6)&(lte IE 7)]>
 <link type="text/css" rel="stylesheet" href="ie6-7.css">
 <![endif]-->

•So I'm wondering if anyone can lend some help. Just assume there's no issues with my code. I would post it but it's for a bank and I don't want to cause any issues.

p.s.- any reason why the, border="0" fix for the ugly borders around images in IE is deprecated element? They want the code to validate and look nice in IE, is this at all posible?

Upvotes: 1

Views: 166

Answers (2)

Christoph
Christoph

Reputation: 51201

conditional stylesheets are completely fine and the preferred way to style for IE. You can use proprietary elements and hide it from the other browsers. Everything okay with that.

border="0" is deprecated like many other attributes to encourage the user to style elements via css and not those ugly inline elements (separate style and content).

And your browserswitch via $.browser (i assume it's jQuery?) is okay, too.

This should be of great help for you: caniuse and MS compat table

Everything should be save and sound, if you go that way.

Upvotes: 0

Sirko
Sirko

Reputation: 74076

You could use soemthing like jQuery.browser for browser detection.

The better solution, however, would be to detect the (breaking) features and insert polyfills in case they are not supported. A great resource for this is Modernizr, which also provides quite a list of polyfills.

Upvotes: 1

Related Questions