Monday, April 20, 2015

IE 8 , IE 9 , IE 10 , IE11 Cool Menus 3 & 4 Not Working? Quick Fix with a Replacement Browser Check Function Script


In the old script there was a Browser Check Function Script.

 Here is the script in its original form.

function lib_bwcheck(){ //Browsercheck (needed) this.ver=navigator.appVersion; this.agent=navigator.userAgent this.dom=document.getElementById?1:0 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ie=this.ie4||this.ie5||this.ie6 this.mac=this.agent.indexOf("Mac")>-1 this.opera5=this.agent.indexOf("Opera 5")>-1 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.dom) return this }

Just add the browser check function for IE 8 , IE 9 , IE 10 and 11.

Replace the browserCheck function as follows:


function lib_bwcheck(){
var isIE=false;
if((navigator.appName.indexOf("Internet Explorer")!=-1) || (navigator.appName.indexOf("Netscape")!=-1) ){
isIE=true;
}
        //this.isIE8 = this.isIE9 = this.isIE10 = // this.isIE11 = false;
        //var hello = this.isIE11;
        this.ver=navigator.appVersion
        this.agent=navigator.userAgent
        this.dom=document.getElementById?1:0
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
        this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom)?1:0;
        this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom)?1:0;
        this.ie9=(this.ver.indexOf("MSIE 9")>-1 && this.dom)?1:0;
        this.ie10=(this.ver.indexOf("MSIE 10")>-1 && this.dom)?1:0;
        this.ie11 = (this.agent.indexOf("Gecko") != -1);
     
        if ( (navigator.appName.indexOf("Netscape")!=-1) )
        this.ie11 = true;
     
        this.ie4=(document.all && !this.dom)?1:0;
        this.ie=this.ie4||this.ie5||this.ie6||this.ie7||this.ie8||this.ie9||this.ie10||this.ie11
        if(isIE){
         this.ie=1;
       
        }
        this.mac=this.agent.indexOf("Mac")>-1
        this.opera5=this.agent.indexOf("Opera 5")>-1
     
     
      /*****************************************************************************
        this.ie11=(this.agent.indexOf("Gecko/") != -1);
        if ( (navigator.appName.indexOf("Netscape")!=-1) && (parseInt(this.ver)>=5)) )
        this.ie11 = true;
        ******************************************************************************/
       
        this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
   
        this.ns4=(document.layers && !this.dom)?1:0;
     
        /*****************************************************************************
       /* if(isIE){
        if ( this.agent.indexOf('rv:') != -1 )
        this.version = this.agent.substring(3+this.agent.indexOf("rv:"));
    else
        this.version = parseFloat(this.agent.substring(4+this.agent.indexOf("msie")));
        this.ie8 = (this.version == "8.0") || (this.ua.indexOf("trident/4") != -1);
    this.ie9 = (this.version == "9.0") || (this.ua.indexOf("trident/5") != -1);
    this.ie10 = (this.version == "10.0") || (this.ua.indexOf("trident/6") != -1);
    this.ie11 = (this.version == "11.0") || (this.ua.indexOf("trident/7") != -1);
    this.version = new cVersion( this.version );
        }
     
 
        ******************************************************************************/
     
        this.bw=(this.ie11 || this.ie8 || this.ie9 || this.ie10 || this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4|| this.ns6 || this.opera5 || this.dom )
        return this
}

The Logic behind this:

Basically you are adding the browser check functionality for IE 8 , IE 9 , 10 and 11.

this.ie8=(this.ver.indexOf("MSIE 8")>-1 && this.dom)?1:0;
        this.ie9=(this.ver.indexOf("MSIE 9")>-1 && this.dom)?1:0;
        this.ie10=(this.ver.indexOf("MSIE 10")>-1 && this.dom)?1:0;
        this.ie11 = (this.agent.indexOf("Gecko") != -1);
     
        if ( (navigator.appName.indexOf("Netscape")!=-1) )
        this.ie11 = true;

"
The IE11 User agent string is basically:
Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko


That would explain the reason for checking "Gecko" and Netscape.

The previous version of windows had  "Internet Explorer" has their navigator appName. Now IE has dropped "MSIE" and adopted to "Internet Explorer".

This should fix the browser check and you might be able to view your JSP page. There might be some compatiblity issues between different versions of IE.

If you have any compatibility issues please refer my next blog posting.