Unigui determine the browser kernel, operating system, and whether to move terminal functions

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.