Menu

finally found the JS bugs for MSIE 4 users

mw zhang
2001-05-03
2012-09-14
  • mw zhang

    mw zhang - 2001-05-03

    Visitors of my site complain that they can not use MSIE4 to access PhpMyChat. As a result of that i worked on the scripts for 2 days and finally found the JS bug complained by the users with MSIE4.

    In index.lib.php3:

    I found the following line:

    ==============
    var IE4 = ((document.all) && (parseInt(navigator.appVersion)>=4)) ? 1 : 0;
    ==============

    which is used to determine the browser type.

    However, it fails to distinguish between MSIE4 and MSIE5.

    The method "navigator.appVersion" returns sth like:
    "4.0 (compatible; MSIE 5.0; Windows 98)"
    and parseInt(navigator.appVersion)>=4) trims the string to the prefix "4". No matter the browser is MSIE4 or MSIE5 the result of the prefix is always "4". That is why it can not tell the difference of MSIE5 and MSIE4.

    As a result of that, all MSIE4 are treated as "H" (high)versions of browsers like MSIE5 that has strong javascript capability. So a couple of javascript bugs occur and prevent the access from those MSIE4 users (that is a pretty bad situation for webmasters like me).

    I suggest that we make use of the information within the brackets ("compatible; MSIE 5.0; Windows 98") instead of the prefix.

    I fixed the bug like this:

    replace

    var IE4 = ((document.all) && (parseInt(navigator.appVersion)>=4)) ? 1 : 0;

    with

        var browser_version = navigator.appVersion;
        var snum = browser_version.indexOf('MSIE ');
        var browser_version = browser_version.substr(snum+5, 3)

        var IE4 = ((document.all) && (parseInt(browser_version)>=5)) ? 1 : 0;

    ==============

    I do not know if my suggestion is in time. Hope it could be of some use to you when you release the new version of PhpMyChat.

     
    • Loïc Chapeaux

      Loïc Chapeaux - 2001-05-03

      Hi 'mw' or Zang (I don't know which one is your first name)!

      Thanks for the suggestion. Well it's a solution you're right but we're searching a fix in an other way at this time.

      IE4 support DHTML and I think the problem isn't related to these so call "advanced javascript feature" we use for phpMyChat. Of course I'm not absolutly sure of this because I don't use IE4 (that's the main problem: no way to test our script with this browser), but I've received some clues that leave me ample food for thought the error comes from the 'loader.php3' script.
      That's the goal of the fix I suggested in the thread just before the one you opened. Have you tried it?

      BTW do you use IE4?

      Anyway thanks a lot for your help and, if we can't find what is the error trully is, we will use your suggestion of course.

      Regards,

       
      • mw zhang

        mw zhang - 2001-05-04

        Hello, loic1,

        Nice to see ur reply :)

        Yes, you are right. My suggestion above is definitely not the ultimate solution to the problem. And i did look at the message you metioned before i post mine. I revised the file loader.php3 according to your instuctions. However, it does not work.

        I have an MSIE 4.7 at home, so i would be very happy to help you test the script. Feel free to contact me. My email: zmw@cmmail.com

        mw

         
        • Loïc Chapeaux

          Loïc Chapeaux - 2001-05-04

          Ok, I've send you an e-mail.

          Thanks for your help,
          Loc

           
          • mw zhang

            mw zhang - 2001-05-05

            I've sent the result of the test to you.
            Tell me if you are making any progress. :)

             
            • Loïc Chapeaux

              Loïc Chapeaux - 2001-05-05

              Have you received my reply? As to me we're not "in progress" but really close to the solution :))

              Regards,

               
              • Loïc Chapeaux

                Loïc Chapeaux - 2001-05-06

                Hi mw!

                OK, in case you don't receive my message here is the next challenge for you.

                First of all the bug you found is a cool one for us! The 'high' version of the chat requires js1.2+ then the faulty instructions you've found are not really required, but I'll try to keep them -with a fix to avoid IE4 js error- for browsers that have a crappy js implementation.

                Then I think the first js error you faced (before frames are displayed) is related to the same problem because the 'chat/lib/index.lib.php3' contains the same faulty instructions than the ones you found inside 'loader.php3'.
                Could you have a look at the 'chat/lib/index.lib.php3' script, search for 'location.assign' (line 581), comment theses lines and try to log in?

                THANKS A LOT for your help,
                Loc

                 
                • Loïc Chapeaux

                  Loïc Chapeaux - 2001-05-06

                  All the users together say: "THANKS TO MAIWEN"!

                  Loc

                   

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.