Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Determine which browser just open a session



Permlink Replies: 2 - Last Post: Jan 26, 2018 9:51 AM Last Post By: Jose Nilton Pace
Ed Brazell

Posts: 8
Registered: 12/16/04
Determine which browser just open a session
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 6:36 PM
I'm trying to figure out when a session is created what browser is being used so I then can determine what format of a form i'm going to display. List desktop vs phone.

Thanks,

Ed
Daniel Fields

Posts: 622
Registered: 11/29/04
Re: Determine which browser just open a session
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 24, 2018 9:49 PM   in response to: Ed Brazell in response to: Ed Brazell
If all you want is to differentiate mobile versus desktop, you can detect for that in the ServerController.OnGetMainForm event.

procedure TIWServerController.IWServerControllerBaseGetMainForm(var vMainForm: TIWBaseForm);
begin
  if WebApplication.Browser.IsMobile then
  begin
    vMainForm := TFormSignupMobile.Create(WebApplication);
  end
  else
  begin
    vMainForm := TFormSignup.Create(WebApplication);
  end;
end;


You could also parse the WebApplication.Request.UserAgent string to look for any specific identifiers that you want. I record that property for every session of my applications. You could also compare WebApplication.Browser to the browser classes defined by IW, such as TAndroid, TChrome, TChromeMobile, TMSEdge, TFirefox, TFirefoxMobile, TInternetExplorer, TOpera, TOperaMobile, TSafari, or TSafariMobile.
Jose Nilton Pace


Posts: 122
Registered: 5/15/98
Re: Determine which browser just open a session
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 26, 2018 9:51 AM   in response to: Ed Brazell in response to: Ed Brazell
Hi Ed. If you use templates (like BootStrap) doesn't matter what browser is being used. Your iw app turn responsive.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02