yhyu1220 / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

IE8 issues (fixed) #92

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
IE8 should not be labeled as IE with the iframe hack, then it behaves
strangely - so the IE detection code should look like this instead (then it
works for me on IE8/win7):

Full browser-detection code:

    var UA = navigator.userAgent.toLowerCase();
    var platform = navigator.platform.toLowerCase();
    var vendor = navigator.vendor || "";
    if (vendor === "KDE") {
      this.isKonqueror = true;
      this.isSupported = false;
    } else if (typeof window.opera !== "undefined") {
      this.isOpera = true;
      this.isSupported = true;
    } else if (navigator.appName == 'Microsoft Internet Explorer')
    {
      var ua = navigator.userAgent;
      var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
      if (rv == 8)
      {
        this.isGecko = true;
        this.isSupported = true;
      } else
      {
        this.isIE = true;
        this.isSupported = true;
      }
    } else if (vendor.indexOf("Apple Computer, Inc.") > -1) {
      this.isSafari = true;
      this.isSupported = (platform.indexOf("mac") > -1);
    } else if (UA.indexOf("gecko") != -1) {
      this.isGecko = true;
      this.isSupported = true;
    }

I've attached my patched rsh.js, it also used /blank.html for the iframe,
per other suggestions in the defect list.

Original issue reported on code.google.com by jonatan....@gmail.com on 19 May 2010 at 12:46

Attachments:

GoogleCodeExporter commented 8 years ago
I had to change a bit of your code to get it to work with IE7 (it worked fine 
in IE 8).

else if (navigator.appName == 'Microsoft Internet Explorer'){

for

else if (typeof document.all !== "undefined") {

Original comment by ama...@gmail.com on 25 May 2010 at 9:47

GoogleCodeExporter commented 8 years ago
It still fails on page running quirks mode (without DOCTYPE declaration). I've 
replace it with code I borrow from ajaxhistory.com.

IE browser-detection code:

   else if (typeof document.all !== "undefined") {
      var iev = 0;
      if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
         iev = new Number(RegExp.$1);
      }
      if(iev >= 8 && document.compatMode == 'BackCompat' || iev < 8) {
         this.isIE = true;
         this.isSupported = true;
      } else {
         this.isGecko = true;
         this.isSupported = true;
      }
   }

Original comment by rudysusa...@gmail.com on 19 Jan 2011 at 6:01