function Getdevicetype (var osname, browsername:string; var ismobiledevice:boolean): String;var I:integer; browserinfo:string; Ostypes, browsertypes:tstringlist;begin Result: = '; Browsername: = ' Unknown '; Osname: = ' Unknown '; IsMobileDevice: = False; Browserinfo: = uniapplication.unisession.requestheader[' user-agent ']; Ostypes: = tstringlist.create; Browsertypes: = tstringlist.create; Try Ostypes.add (' Ipod '); Ostypes.add (' Ipad '); Ostypes.add (' Iphone '); Ostypes.add (' J2ME/MIDP '); Ostypes.add (' Palm '); Ostypes.add (' BlackBerry '); Ostypes.add (' PlayStation '); Ostypes.add (' Symbian '); Ostypes.add (' Windows Mobile '); Ostypes.add (' Windows CE '); Ostypes.add (' Windows Phone '); Ostypes.add (' PPC '); Ostypes.add (' Android '); Ostypes.add (' Mac '); Ostypes.add (' Windows '); Ostypes.add (' Linux '); Ostypes.add (' Unknown '); Microsoft IE Browsertypes.add (' MSIE 5.5 '); Browsertypes.add (' MSIE 6.5 '); Browsertypes.add (' MSIE 7.0 '); Browsertypes.adD (' MSIE 8.0 '); Browsertypes.add (' MSIE 9.0 '); Browsertypes.add (' MSIE 10.0 '); Browsertypes.add (' MSIE 11.0 '); Browsertypes.add (' MSIE '); Browsertypes.add (' Netscape '); Netscape Browsertypes.add (' Firefox '); Firefox browsertypes.add (' Chrome '); Google Browsertypes.add (' Safari '); Browsertypes.add (' Opera '); For I: = 0 to Browsertypes.count-1 do BEGIN if Pos (Uppcase (Browsertypes[i]), Uppcase (browserinfo)) <> 0th En begin browsername: = Browsertypes[i]; break; End End For I: = 0 to Ostypes.count-1 does begin if Pos (Uppcase (Ostypes[i]), Uppcase (browserinfo)) <> 0 then is Gin Osname: = Ostypes[i]; break; End End IsMobileDevice: = Ostypes.indexof (osname) <= ostypes.indexof (' Android '); Finally Freeandnil (ostypes); Freeandnil (browsertypes); End;end; Method of Use Getdevicetype (Osname, Browsername, IsMobileDevice); ShowMessage (' OS type: ' + osname); ShowMessage (' Browser kernel: ' + browsername); If IsMobileDevice then ShowMessage (' mobile device ') Else showmessage (' non-mobile device '); Show IE browser using if Pos (' MSIE ', browsername) <> 0 THEN BEGIN ShowMessage (' This system is not currently supported by Microsoft IE Kernel Browser, it is recommended to use a browser based on Google Chrome kernel! '); Close; End
Unigui determine the browser kernel, operating system, and whether to move terminal functions