Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Intraweb and CGDevTools. How to find if user is opening on mobile or desk


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Mar 4, 2015 2:48 PM Last Post By: Daniel Fields
Ilir Isaj

Posts: 1
Registered: 6/9/02
Intraweb and CGDevTools. How to find if user is opening on mobile or desk  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 4, 2015 3:18 AM
I am creating an application for desktop browser and mobile also.

When the user browse with mobile it should show the mobile version of the app and if using desktop to show the full desktop web app.

I have IW 14.0.36.
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: Intraweb and CGDevTools. How to find if user is opening on mobile or desk  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 4, 2015 5:59 AM   in response to: Ilir Isaj in response to: Ilir Isaj
hi

in the ServerController there is an Event called OnBrowserCheck.
in it you can check the browser like this :

  If rBrowser.IsMobile Then With TfrmMobileLogin Do Begin
    SetAsMainForm;
    Show;
  End
  Else With TfrmLogin Do begin
    SetAsMainForm;
    Show;
  End


you need to add the Login, and MobileLogin units to the ServerController's "uses" of course.


but i have my own question regarding this issue :
do we REALLY need to re-write everything, and DOUBLE the whole application, just so we could see everything normal on both the desktop and mobile browsers...?
isn't there some "line" to add somewhere, that would tell the IW to work a little differently on desktop and mobile, and just fit the visual to the right sizes?

Eitan

Daniel Fields

Posts: 622
Registered: 11/29/04
Re: Intraweb and CGDevTools. How to find if user is opening on mobile or desk  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 4, 2015 2:48 PM   in response to: Eitan Arbel in response to: Eitan Arbel
I use the same properties that Eitan suggested. I also use the API at http://www.useragentstring.com. The service is free (but takes donations) . They breakdown the user agent string and one of the possible return properties is a Mobile Device flag. They work from a database of known agent string elements. They list 22 mobile browsers, which I use as an extra detection layer.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02