NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: trent on April 22, 2014, 10:25:32 PM

Title: Suppress Tool Tips in Desktop Mode
Post by: trent on April 22, 2014, 10:25:32 PM
Hi Bruce,

Is there any way to suppress tool tips in desktop mode when the device is a tablet?

Regards,
Trent
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: Bruce on April 22, 2014, 10:45:40 PM
Suppressing tips is easy; set

p_web.site.notips = true

I'd do this in the webHandler, ProcessLink method, before the parent call.

Figuring out if the user is on a tablet is harder. More specifically, when is a tablet not a tablet? For example, a surface pro with a keyboard and mouse. Is that still a tablet?

but let's pick the low-hanging fruit of Android and iOS.


if p_web.IsMenuTouch()
  p_web.site.notips = true
end


cheers
Bruce
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: trent on April 22, 2014, 11:03:52 PM
That's awesome thanks Bruce!

I was testing the screen width using javascript to load desktop mode if mobile mode was set and the screen width is larger than a standard mobile phone width:

<script type="text/javascript">
$(document).ready(function(){
  if ($(window).width() > 600) {
    SetSessionValue('tablet',1);
    window.open("LoginForm?_mobile_=0","_self");
  } 
});
</script>

That stops mobile mode from loading automatically on a tablet. BUT p_web.IsMenuTouch() seems easier. What does it do exactly?

Regards,
Trent
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: Bruce on April 23, 2014, 02:59:21 AM
check out netweb.clw and you'll see the code. It's not going to work everywhere (especially devices like Surface which have a mouse and Touch) but it deals with the obvious stuff in the short term.
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: trent on April 23, 2014, 01:10:13 PM
Ahh I see, thanks Bruce.
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: trent on April 28, 2014, 03:19:05 PM
Hi Bruce,

Just tested this with an iPad and it is not working. Looking at the User-Agent string that is coming in from the iPad, the IsMenuTouch() method isn't able to correctly match for an iPad.

IsMenuTouch currently looks for:

instring('ipad ',self._useragent,1,1)

...but the User-Agent string of this particular iPad was:

User-Agent: Mozilla/5.0 (iPad; CPU OS 7_1 like Mac OS X) AppleWebKit...

I think you may want to remove the space in each of the 'instring' check of this method so they look like:

instring('ipad',self._useragent,1,1)

Regards,
Trent
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: Bruce on April 28, 2014, 10:59:18 PM
done
Title: Re: Suppress Tool Tips in Desktop Mode
Post by: trent on April 28, 2014, 11:50:06 PM
Awesome, thank you!