Anuchit Posted October 19, 2018 Posted October 19, 2018 on Desktop , I can check what's browser using on Event Form OnActivate on Mobile no have Event OnActivate I'm try use Event OnShow , OnCreate , OnReady but can't Show browser type and browser version , ... what Event I can use on Mobile, When I want to show Browser Type and Browser Version
Sherzod Posted October 19, 2018 Posted October 19, 2018 Hi, 1 hour ago, Anuchit said: ... what Event I can use on Mobile, When I want to show Browser Type and Browser Version First of all, what code do you use to detect browser type and version ?
Anuchit Posted October 19, 2018 Author Posted October 19, 2018 54 minutes ago, Sherzod said: Hi, First of all, what code do you use to detect browser type and version ? Thank you for Reply.
Sherzod Posted October 19, 2018 Posted October 19, 2018 Sorry, what do you need that for, just for information... ?
Anuchit Posted October 19, 2018 Author Posted October 19, 2018 1 hour ago, Sherzod said: Sorry, what do you need that for, just for information... ? I want to Check Browser when user use my application I want to customize them using Chorme or Safari . if (C.BrowserType <> 'chrome') or (C.BrowserType <> 'safari') then begin ShowMessage('Can use on Chrome or safari !!!'); end;
Marlon Nardi Posted October 20, 2018 Posted October 20, 2018 class function TSistema.GetNavegador: string; var C : TUniClientInfos; begin C := UniApplication.ClientInfo; if ciIE in C then Result := 'IE' else if ciFireFox in C then Result := 'FireFox' else if ciOpera in C then Result := 'Opera' else if ciSafari in C then Result := 'Safari' else if ciChrome in C then Result := 'Chrome' else Result := 'Other'; //(or and) you can use it with userAgent and add browsers according to your need .. if UniSession.UserAgent <> EmptyStr then begin if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) then Result := 'Chrome'; if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) and (Pos('opr',LowerCase(UniSession.UserAgent))> 0) then Result := 'Opera'; if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) and (Pos('edge',LowerCase(UniSession.UserAgent))> 0) then Result := 'Edge'; end; end;
Anuchit Posted October 21, 2018 Author Posted October 21, 2018 12 hours ago, Marlon Nardi said: class function TSistema.GetNavegador: string; var C : TUniClientInfos; begin C := UniApplication.ClientInfo; if ciIE in C then Result := 'IE' else if ciFireFox in C then Result := 'FireFox' else if ciOpera in C then Result := 'Opera' else if ciSafari in C then Result := 'Safari' else if ciChrome in C then Result := 'Chrome' else Result := 'Other'; //(or and) you can use it with userAgent and add browsers according to your need .. if UniSession.UserAgent <> EmptyStr then begin if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) then Result := 'Chrome'; if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) and (Pos('opr',LowerCase(UniSession.UserAgent))> 0) then Result := 'Opera'; if (Pos('chrome',LowerCase(UniSession.UserAgent))> 0) and (Pos('edge',LowerCase(UniSession.UserAgent))> 0) then Result := 'Edge'; end; end; I will try this. Thank you so much
Recommended Posts