You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Net Dawg <ne...@yahoo.com.INVALID> on 2014/08/12 11:33:49 UTC

Browser Detection

Does tapestry have a way to detect browser/version within component/page class?  Or by convention recommend some procedure?  To support logic <t:if test="${browserType.version}">rendering something</t:if> 

Re: Browser Detection

Posted by Michael Gentry <mg...@masslight.net>.
Here is what I currently use (which may not be the best approach, but works
for my present needs).

UserAgent Service:

https://gist.github.com/mrg/b814a42d86597440c9d9

I primarily use it in this IEWarning component, which I have in my Layout:

https://gist.github.com/mrg/ba7395fa89a48a4c423d

mrg



On Tue, Aug 12, 2014 at 5:53 AM, Net Dawg <ne...@yahoo.com.invalid>
wrote:

> Thanks.  Probably wrong question.  Best practice seems to be to detect
> capability supported in the user agent, not type, version etc.
>
>
>
> http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie
>
>
>
>
> On Monday, August 11, 2014 11:42 PM, Muhammad Gelbana <m....@gmail.com>
> wrote:
>
>
>
> I would @Inject Tapestry's Request
> <
> http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/services/Request.html
> >
> and
> read it's headers. Just google on how to detect a specific browser. Since
> you'll probably handle multiple browsers you may find these components very
> handy:
>
> http://tapestry.apache.org/switching-cases.html
>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Delegate.html
>
>
> *---------------------*
> *Muhammad Gelbana*
> http://www.linkedin.com/in/mgelbana
>
>
>
> On Tue, Aug 12, 2014 at 12:33 PM, Net Dawg <ne...@yahoo.com.invalid>
> wrote:
>
> > Does tapestry have a way to detect browser/version within component/page
> > class?  Or by convention recommend some procedure?  To support logic
> <t:if
> > test="${browserType.version}">rendering something</t:if>
>

Re: Browser Detection

Posted by Net Dawg <ne...@yahoo.com.INVALID>.
Thanks.  Probably wrong question.  Best practice seems to be to detect capability supported in the user agent, not type, version etc. 


http://stackoverflow.com/questions/13478303/correct-way-to-use-modernizr-to-detect-ie

 


On Monday, August 11, 2014 11:42 PM, Muhammad Gelbana <m....@gmail.com> wrote:
 


I would @Inject Tapestry's Request
<http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/services/Request.html>
and
read it's headers. Just google on how to detect a specific browser. Since
you'll probably handle multiple browsers you may find these components very
handy:

http://tapestry.apache.org/switching-cases.html
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Delegate.html


*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana



On Tue, Aug 12, 2014 at 12:33 PM, Net Dawg <ne...@yahoo.com.invalid>
wrote:

> Does tapestry have a way to detect browser/version within component/page
> class?  Or by convention recommend some procedure?  To support logic <t:if
> test="${browserType.version}">rendering something</t:if>

Re: Browser Detection

Posted by Muhammad Gelbana <m....@gmail.com>.
I would @Inject Tapestry's Request
<http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/services/Request.html>
and
read it's headers. Just google on how to detect a specific browser. Since
you'll probably handle multiple browsers you may find these components very
handy:

http://tapestry.apache.org/switching-cases.html
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Delegate.html


*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana


On Tue, Aug 12, 2014 at 12:33 PM, Net Dawg <ne...@yahoo.com.invalid>
wrote:

> Does tapestry have a way to detect browser/version within component/page
> class?  Or by convention recommend some procedure?  To support logic <t:if
> test="${browserType.version}">rendering something</t:if>