Is there a way from a client script to determine if the current UI is UI14 or UI11?

Dan Spada
Tera Contributor

Is there a way from a client script to determine if the current UI is UI14 or UI11?

 

We have a client script that we want to run if the current version is UI 14, but not if it's UI11. Essentially this has come from IE8 and below not supporting some of our customizations.

 

One way is to use Javascript to get the navigator.appVersion property and check the browser version, though this seems like it could get messy when the current UI version will give us the information we require.

 

Is there a built in property that will give us this information?

 

Cheers,

 

Dan

1 ACCEPTED SOLUTION

Good point, I suppose he would already know if the property was set to true or not anyway.   I found something online that seems to work when I dumped it in an onLoad script:



function onLoad() {


    //Type appropriate comment here, and begin script below




var browser=get_browser();


var browser_version=get_browser_version();


alert(browser + " - " + browser_version);




function get_browser(){


      var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];


      if(/trident/i.test(M[1])){


              tem=/\brv[ :]+(\d+)/g.exec(ua) || [];


              return 'IE '+(tem[1]||'');


              }    


      if(M[1]==='Chrome'){


              tem=ua.match(/\bOPR\/(\d+)/);


              if(tem!=null)     {return 'Opera '+tem[1];}


              }    


      M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];


      if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}


      return M[0];


      }




function get_browser_version(){


      var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];                                                                                                                                                                                                                                                


      if(/trident/i.test(M[1])){


              tem=/\brv[ :]+(\d+)/g.exec(ua) || [];


              return 'IE '+(tem[1]||'');


              }


      if(M[1]==='Chrome'){


              tem=ua.match(/\bOPR\/(\d+)/);


              if(tem!=null)     {return 'Opera '+tem[1];}


              }    


      M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];


      if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}


      return M[1];


      }




   


}


View solution in original post

11 REPLIES 11

acretion
Tera Expert

The property glide.ui.doctype will be true if UI14 is enabled, not sure if that is what you mean or not.


if I understand correctly, the glide.ui.doctype property can only be accessed from the server, and not by the client in a client script?


gs.getProperty is only available server side, but you could use a glide ajax callback to get it, or use a display business rule to load the value into the scratchpad for use in your scipts


I don't think that's going to help you, as that's just the system property to see if it's enabled.   It would still be true for IE8 users that are forced back to UI11.



I don't know of anything in particular, but there is probably an element somewhere on the page that can be checked for to determine whether they are on UI14 or UI11.   Just compare the two and choose something that's different, then look at the html code for an element named differently, or one that exists in one but not the other.