Testing User Agent from Zinc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing User Agent from Zinc

horrido
Is there any way I can check the user agent string from Zinc or Teapot so
that I can determine whether the user is on a mobile device?

I need to modify the HTML accordingly and it's really, really messy trying
to do this with JavaScript (navigator.userAgent) and conditionally inserting
innerHTML.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Testing User Agent from Zinc

horrido
After much digging, I finally found the solution...

From the req parameter in GET, I use:

(req headers headers at: 'User-Agent') findString: 'Mobile'



horrido wrote

> Is there any way I can check the user agent string from Zinc or Teapot so
> that I can determine whether the user is on a mobile device?
>
> I need to modify the HTML accordingly and it's really, really messy trying
> to do this with JavaScript (navigator.userAgent) and conditionally
> inserting
> innerHTML.
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Testing User Agent from Zinc

Ben Coman
cool

On Tue, 11 Dec 2018 at 01:18, horrido <[hidden email]> wrote:
After much digging, I finally found the solution...

From the req parameter in GET, I use:

(req headers headers at: 'User-Agent') findString: 'Mobile'



horrido wrote
> Is there any way I can check the user agent string from Zinc or Teapot so
> that I can determine whether the user is on a mobile device?
>
> I need to modify the HTML accordingly and it's really, really messy trying
> to do this with JavaScript (navigator.userAgent) and conditionally
> inserting
> innerHTML.
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html