LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 April 10 2010

hussam
Member

Grrr... Ie6 :(

my website validates correctly using w3c validator as correct html5 and css 2.1
It renders correct under firefox, webkitgtk.
According to here http://ipinfo.info/netrenderer/index.php , it also renders correctly under IE7 and 8 but not IE6
I need a php code that is a small box with a warning that IE6 doesn't render this page correctly and users are advised to upgrade to IE7 or 8 or use firefox. The warning box should only appear to IE6 users.

Last edited by hussam (April 10 2010)

Offline

#2 April 10 2010

Ayman
Member

Re: Grrr... Ie6 :(

IE6 is a terrible browser and it is "3a 7affet abro" IMO  anyways you can acheive what you want through detecting the current browser in Javascript and then modify the content of your "box" who's id is content in this case in the example:

<script type="text/javascript">
function detectBrowser()
{

var browser=navigator.appName;
var browser_version=navigator.appVersion;
var version=parseFloat(browser_version);

if (browser =="Microsoft Internet Explorer") && (version>=7))
    document.getElementById("message").value = "Your browser is okay."; 

  else
    document.getElementById("message").value = "Change that browser! ";  
  }
 </script>

and make sure you call this function when the page loads inside your body tag like this:

<body onLoad="detectBrowser()">

Hope this helps good luck :)

Last edited by Ayman (April 10 2010)

Offline

#3 April 10 2010

rolf
Member

Re: Grrr... Ie6 :(

I like IE 6 more then the following, it is light on memory and has a clean interface with no useless features.
Unfortunately some extra demanding websites can crash it easily, but I think it will work OK with most websites, or will it? I haven't checked for a while.

Oh, and BTW, for IE I use conditional comments. I find it easier then javascript detection - but thanks for the code :) .
Here is a description:

<!--[if IE 6]>
write some stuff here, HTML, or whatever
<![endif]-->
The "stuff" that you write in these comments, will only be parsed by ie6, other browsers will correctly interpret it as a comment and skip it. You can also use [if IE 7], or 8 or even 6.5 ... or just [if IE] to cover all IE versions.

Another trick will also do the inverse effect, IE interprets the "comment" tag, which is a non-standard tag hence ignored by other browsers. You can use it for the inverse effect, that is to define code that will be parsed in all other browsers but skipped in IE
example:
<comment> something </comment>
Only IE will consider this as a comment and skip "something". I only tested this on IE 8 though.

Here is the page where I got all this info from:

http://www.quirksmode.org/css/condcom.html

Offline

#4 April 10 2010

hussam
Member

Re: Grrr... Ie6 :(

I have a problem
I put the javascript function in <head> ...... </head>
but <body onLoad="detectBrowser()"> </body> isn't calling it.

IE6 renders png images incorrectly.

this works
<?php

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0') !== false) {
    echo 'You are currently using Internet Explorer 6.0. Consider upgrading to Internet Explorer 7 or 8';
}
?>

Last edited by hussam (April 10 2010)

Offline

Board footer