Posts: 65
Threads: 21
Joined: Mar 2018
Reputation:
0
Planning on set of mobile friendly screens for my app.
Need to detect mobile phones and tablets.
How to detect phone based browsers so I can show mobile phone login ?
Tablets are usually fine for full app in landscape. Would be nice to be able to alert user to rotate into landscape.
I probably should have checked to see if there is a demo for this .....
Cheers!
Posts: 210
Threads: 52
Joined: Mar 2018
Reputation:
3
Location: Bryan, TX
Howdy Lou!
In the ServerController, use the OnBrwoserCheck event. In the event, you will see a parameter of TBrowser. The TBrowser has an IsMobile property.
Hope this helps.
All the best,
Shane
Posts: 114
Threads: 32
Joined: Dec 2019
Reputation:
1
Location: Россия
Something is not working... Always defines as stationary. Look, I probably wrote something wrong...
ServerController:
public
{ Public declarations }
mMobile : Boolean;
end;
...
procedure TIWServerController.IWServerControllerBaseBrowserCheck(
aSession: TIWApplication; var rBrowser: TBrowser);
begin
if rBrowser.IsMobile
then mMobile := true
else mMobile := false;
end;
procedure TfmVmMain.IWAppFormShow(Sender: TObject);
var
begin
if TIWServerController(WebApplication).mMobile then
begin
lblbUser.Caption := 'Mobile';
end else begin
lblbUser.Caption := 'Stationary';
end;
end;
Always defines as Stationary
Posts: 227
Threads: 4
Joined: Mar 2018
Reputation:
22
Try WebApplication.Browser.isMobile
I'm not sure which is more reliable but that's what I've used for observation. I don't have behavior dependent on it but believe it would work fine.
Dan
Posts: 25
Threads: 6
Joined: May 2018
Reputation:
0
Location: HELL
aSession.mMobile ?
Its should be a variable of Usersession unit.
Posts: 114
Threads: 32
Joined: Dec 2019
Reputation:
1
Location: Россия
05-23-2021, 01:48 AM
(This post was last modified: 05-23-2021, 01:49 AM by Сергей Александрович.)
Thank you! "WebApplication.Browser.IsMobile" - works !