NetTalk Central

Author Topic: Mobile and desktop mode confusion  (Read 2988 times)

AvanIeperen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Mobile and desktop mode confusion
« on: February 19, 2013, 06:27:38 AM »
Using NT 7.05. In the webhandler i have the site mode set to "Detect".

I open the website on my tablet (Asus transformer TF700). It is in mobile mode.
I press a link and goto the next page on the website. It is still in mobile mode.
I press the back button and go to the first page. It is now in desktop mode.
No matter which page i try the website stays in desktop mode.
I have to restart the browser to get back to mobile mode.

What is causing this problem? Is there anything i can do to fix this besides setting the site to mobile mode only?

Also sometimes when i open the first page of the website the layout will be mobile mode but the width will be desktop mode. I think this is probably due to some bad css on my part.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Mobile and desktop mode confusion
« Reply #1 on: February 19, 2013, 04:46:52 PM »
most tablets are big enough to run a normal website without going into mobile mode. There have been numerous discussions around this topic on this NG. Bruce added some extra ways to detect screen size (which you can see on the Nettalk console log). You can use these to force the website into mobile mode. It is odd though it would go out of mobile mode.

AvanIeperen

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Mobile and desktop mode confusion
« Reply #2 on: February 20, 2013, 12:15:48 AM »
The tablet handles desktop mode well. But the problem is the automatic switching between modes. It doesn't happen when i use a desktop and it doesn't happen when i use an iPhone.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Mobile and desktop mode confusion
« Reply #3 on: February 20, 2013, 12:27:43 AM »
What's happening here is that it's using both the User-Agent and Screen-size approaches to "detecting" mobile mode.

you have some control over it however.

first thing to decide for yourself is "what is mobile mode" - ie should it apply to phones (say 5 inches or smaller) or should it be based on the OS (Android, iOs etc) or should it be based on the input format (touch etc) ?

In the WebHandler procedure there are a couple settings, and a couple methods you can use to customize behavior.

Firstly - you can set the "resolution" in the WebServer procedure, Mobile tab. This can be helpful, except that you now get _phones_ with a resolution of 1024 x 768. So in some cases even resolution can be unhelpful.
(In your current case the resolution being received from the device is higher than the value you have set here).

You can avoid it detecting by resolution by overriding the method in the WebHandler procedure;
SetMobileBasedOnSize method
before parent call
return.

The other detection option is using the User-Agent field. ie detecting "android" or "ios" or whatever. There's a method in web handler for this
SetMobileBasedOnAgent
at the moment the built-it method works - but obviously may be or may not be what you want.

cheers
Bruce