SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot martin's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hiding css from IE 6?

    Hi, I have been hiding the following statement from IE 5 and 5.5 using the "box model hack" mentioned in various sites.

    position: fixed;

    so that Netscape 6 etc could make use of it. However, this no longer works for IE 6 as they have fixed the bug but unfortunatly IE 6 still does not recognise the above statement either!

    Can I hide this statement from IE 6 but still have it for Nav 6/7??

    Any thoughts on this appreciated...
    Martin

  2. #2
    SitePoint Addict mserms's Avatar
    Join Date
    Jun 2001
    Location
    Scotland
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    'Fraid I've got this problem too. Is this a fairly frequent problem?

  3. #3
    SitePoint Zealot martin's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know, its not so much that it does not stay on screen when I scroll, more that it actually displays in the wrong position!

    If it was positioned correctly then I wouldnt have a problem. Does anyone have a 'sniffer' for IE 6 Windows?

    Currently I have just had to disable position: fixed and re-state position:absolute for the item to at least display in the correct place, which is a shame!
    Martin

  4. #4
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use the following for a browser sniffer:

    if(document.getElementById) {
    //Do something in IE
    }
    else if(document.layers) {
    //Do something in Netscape
    }
    else {
    //Do something in other browsers
    }


    But, I don't know if this will work for you because it doesn't detect browser versions. I've never had to detect the version of the browser, just the browser type.
    [ metabahn ] : changing the course of the web.

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    bcp, your code probably does not detect very well. document.getElementById is used in Mozilla now, which translates to Netscape 6/7. It is also used in the Konqueror browser on Linux. Document.layers only works in NS4. If you want IE-specific javascript you use document.all[] but document.getElementById is the best way to go.

    As to the problem at hand, hiding styles from IE6. The best way is probably to do a server-side check using PHP or ASP, then only sending down the appropriate CSS for that browser.

    --Vinnie



    Originally posted by bcp_2005
    I use the following for a browser sniffer:

    if(document.getElementById) {
    //Do something in IE
    }
    else if(document.layers) {
    //Do something in Netscape
    }
    else {
    //Do something in other browsers
    }


    But, I don't know if this will work for you because it doesn't detect browser versions. I've never had to detect the version of the browser, just the browser type.

  6. #6
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks vgarcia. I guess I'll have to find a different way to check browser types. Why can't there just be ONE standard browser ?!?! It would make EVERYBODY'S life MUCH easier.
    [ metabahn ] : changing the course of the web.

  7. #7
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by bcp_2005
    Thanks vgarcia. I guess I'll have to find a different way to check browser types. Why can't there just be ONE standard browser ?!?! It would make EVERYBODY'S life MUCH easier.
    That's why standards bodies exists. If everyone plays by the rules, you don't have these problems. Sadly, however, Microsoft doesn't think the rules apply to them.

    So just as a point of correction, it's not that we need one standard browser... we just need to use browsers that follow the one standard.
    ----Adopt-a-Sig----
    Your message here!

  8. #8
    webality...dunno what it means bcp_2005's Avatar
    Join Date
    Jun 2002
    Location
    Huntsville Alabama
    Posts
    394
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very good point randem. Thanks for correcting me.
    [ metabahn ] : changing the course of the web.

  9. #9
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Well, document.getElementById() will work in all standards-compliant browsers. So create a generic detection script.

    Code:
    <script language="javascript" type="text/javascript">
      function sniff() {
       var UA = navigator.userAgent;
       var AV = navigator.appVersion;
      //check for ie 5+ (standards-compliant), also check for
      //Opera's fake user agent strings
       if(UA.indexOf('MSIE') > -1 && AV >= 5 && UA.indexOf('Opera')==-1){
       return 'standards';
       }
        //check for gecko-based browsers (Moz, NS6+, etc)
       if (UA.indexOf('Gecko') > -1 && UA.indexOf('Opera')==-1){
          return 'standards';
         }
       
        //check for Konqueror 
         if(UA.indexOf('Konqueror')> -1){
          return 'standards';
         }
       
       //check for ******* NS4 with document.layers
       if(document.layers){
       return 'NS4';
       }
    
         //check for ie4
         if(UA.indexOf('MSIE') > -1 && AV==4){
         return 'IE4';
         }
        }
        }
      }
    </script>
    Add your own checks for opera or other browsers as you see fit.

    --Vinnie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •