You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Corbin, James" <jc...@iqnavigator.com> on 2012/11/12 15:40:24 UTC

Detecting HTML 5 Features in Wicket

Is there any built in support for detecting HTML 5 browser features like Web Storage?

If not, what is  the recommended approach for doing so?

I'm looking for a way to detect support for Web (e.g. Local) Storage, so in cases where the browser's do not support it (e.g., IE7), I can use cookies or some other mechanism instead.

Thanks,

J.D.

Re: Detecting HTML 5 Features in Wicket

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

To detect browser capabilities you have to use WebClientInfo. See
http://www.wicket-library.com/wicket-examples-6.0.x/hellobrowser/<http://www.wicket-library.com/wicket-examples-6.0.x/hellobrowser/howdy>

By default there is no info for Web Storage, so you will need a custom
BrowserInfoPage,
see org.apache.wicket.protocol.http.WebSession#newBrowserInfoPage


On Mon, Nov 12, 2012 at 4:40 PM, Corbin, James <jc...@iqnavigator.com>wrote:

> Is there any built in support for detecting HTML 5 browser features like
> Web Storage?
>
> If not, what is  the recommended approach for doing so?
>
> I'm looking for a way to detect support for Web (e.g. Local) Storage, so
> in cases where the browser's do not support it (e.g., IE7), I can use
> cookies or some other mechanism instead.
>
> Thanks,
>
> J.D.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Detecting HTML 5 Features in Wicket

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Nov 12, 2012 at 5:10 PM, Corbin, James <jc...@iqnavigator.com>wrote:

> Thanks, I have already.  I know how to detect HTML5 features using
> javascript, just wondered what is the best way to do so from Wicket code.
> Given your suggestion, how could I use Modernizr to set browser state
> indicating, for example, that HTML 5 local storage is in fact supported.
> I'm just not sure how to plug something like this into the initialization
> of the web application.  It would be nice if the gather extended browser
> info support in Wicket supported these properties.
>
> I'm just curious how others have managed to answer the question, "Does my
> browser and version support HTML 5 Local Storage?", from Wicket code.
>
>
The best is to not answer this question at all.
Use a JS library that cares about the persistence at the client side for
you. So you use it as abstraction layer.


> Thanks,
> J.D.
>
>
>
>
>
>
>
> On 11/12/12 7:59 AM, "Phillips, David" <Da...@usaa.com> wrote:
>
> >I would suggest taking a look at Modernizr (http://modernizr.com/) for
> >feature detection.
> >
> >Thanks,
> >-David Phillips - USAA
> >
> >-----Original Message-----
> >From: Corbin, James [mailto:jcorbin@iqnavigator.com]
> >Sent: Monday, November 12, 2012 8:40 AM
> >To: users@wicket.apache.org
> >Subject: EXTERNAL: Detecting HTML 5 Features in Wicket
> >
> >Is there any built in support for detecting HTML 5 browser features like
> >Web Storage?
> >
> >If not, what is  the recommended approach for doing so?
> >
> >I'm looking for a way to detect support for Web (e.g. Local) Storage, so
> >in cases where the browser's do not support it (e.g., IE7), I can use
> >cookies or some other mechanism instead.
> >
> >Thanks,
> >
> >J.D.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Detecting HTML 5 Features in Wicket

Posted by "Corbin, James" <jc...@iqnavigator.com>.
Thanks for the suggestions.

J.D.







On 11/12/12 9:05 AM, "Phillips, David" <Da...@usaa.com> wrote:

>'getBatherExtendedBrowserInfo()' really just builds a small page to test
>client side settings which posts back the information it's gathered. That
>page is provided from 'newBrowserInfoPage()' in WebSession.
>
>Thus, if you want to plug Modernizr into your session before the page
>load, you can override this method and provide a custom page which
>includes Modernizr. Three things to note about this approach. First, you
>should probably start with just extending the 'BrowserInfoPage' class to
>get it's built in postback functionality. Second, this callback doesn't
>trigger until you call 'WebSession.getClientInfo()' for the first time,
>so make sure that's done before any heavy lifting. Finally, I would
>suggest embedding Modernizr onto your new page directly instead of
>linking a JS file. This is mainly to reduce latency overhead from
>multiple requests.
>
>Thanks,
>-David Phillips - USAA
>
>-----Original Message-----
>From: Corbin, James [mailto:jcorbin@iqnavigator.com]
>Sent: Monday, November 12, 2012 9:11 AM
>To: users@wicket.apache.org
>Subject: EXTERNAL: Re: Detecting HTML 5 Features in Wicket
>
>Thanks, I have already.  I know how to detect HTML5 features using
>javascript, just wondered what is the best way to do so from Wicket code.
>Given your suggestion, how could I use Modernizr to set browser state
>indicating, for example, that HTML 5 local storage is in fact supported.
>I'm just not sure how to plug something like this into the initialization
>of the web application.  It would be nice if the gather extended browser
>info support in Wicket supported these properties.
>
>I'm just curious how others have managed to answer the question, "Does my
>browser and version support HTML 5 Local Storage?", from Wicket code.
>
>Thanks,
>J.D.
>
>
>
>
>
>
>
>On 11/12/12 7:59 AM, "Phillips, David" <Da...@usaa.com> wrote:
>
>>I would suggest taking a look at Modernizr (http://modernizr.com/) for
>>feature detection.
>>
>>Thanks,
>>-David Phillips - USAA
>>
>>-----Original Message-----
>>From: Corbin, James [mailto:jcorbin@iqnavigator.com]
>>Sent: Monday, November 12, 2012 8:40 AM
>>To: users@wicket.apache.org
>>Subject: EXTERNAL: Detecting HTML 5 Features in Wicket
>>
>>Is there any built in support for detecting HTML 5 browser features
>>like Web Storage?
>>
>>If not, what is  the recommended approach for doing so?
>>
>>I'm looking for a way to detect support for Web (e.g. Local) Storage,
>>so in cases where the browser's do not support it (e.g., IE7), I can
>>use cookies or some other mechanism instead.
>>
>>Thanks,
>>
>>J.D.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Detecting HTML 5 Features in Wicket

Posted by "Phillips, David" <Da...@usaa.com>.
'getBatherExtendedBrowserInfo()' really just builds a small page to test client side settings which posts back the information it's gathered. That page is provided from 'newBrowserInfoPage()' in WebSession.

Thus, if you want to plug Modernizr into your session before the page load, you can override this method and provide a custom page which includes Modernizr. Three things to note about this approach. First, you should probably start with just extending the 'BrowserInfoPage' class to get it's built in postback functionality. Second, this callback doesn't trigger until you call 'WebSession.getClientInfo()' for the first time, so make sure that's done before any heavy lifting. Finally, I would suggest embedding Modernizr onto your new page directly instead of linking a JS file. This is mainly to reduce latency overhead from multiple requests.

Thanks,
-David Phillips - USAA

-----Original Message-----
From: Corbin, James [mailto:jcorbin@iqnavigator.com] 
Sent: Monday, November 12, 2012 9:11 AM
To: users@wicket.apache.org
Subject: EXTERNAL: Re: Detecting HTML 5 Features in Wicket

Thanks, I have already.  I know how to detect HTML5 features using javascript, just wondered what is the best way to do so from Wicket code.
Given your suggestion, how could I use Modernizr to set browser state indicating, for example, that HTML 5 local storage is in fact supported.
I'm just not sure how to plug something like this into the initialization of the web application.  It would be nice if the gather extended browser info support in Wicket supported these properties.

I'm just curious how others have managed to answer the question, "Does my browser and version support HTML 5 Local Storage?", from Wicket code.

Thanks,
J.D.







On 11/12/12 7:59 AM, "Phillips, David" <Da...@usaa.com> wrote:

>I would suggest taking a look at Modernizr (http://modernizr.com/) for 
>feature detection.
>
>Thanks,
>-David Phillips - USAA
>
>-----Original Message-----
>From: Corbin, James [mailto:jcorbin@iqnavigator.com]
>Sent: Monday, November 12, 2012 8:40 AM
>To: users@wicket.apache.org
>Subject: EXTERNAL: Detecting HTML 5 Features in Wicket
>
>Is there any built in support for detecting HTML 5 browser features 
>like Web Storage?
>
>If not, what is  the recommended approach for doing so?
>
>I'm looking for a way to detect support for Web (e.g. Local) Storage, 
>so in cases where the browser's do not support it (e.g., IE7), I can 
>use cookies or some other mechanism instead.
>
>Thanks,
>
>J.D.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Detecting HTML 5 Features in Wicket

Posted by "Corbin, James" <jc...@iqnavigator.com>.
Thanks, I have already.  I know how to detect HTML5 features using
javascript, just wondered what is the best way to do so from Wicket code.
Given your suggestion, how could I use Modernizr to set browser state
indicating, for example, that HTML 5 local storage is in fact supported.
I'm just not sure how to plug something like this into the initialization
of the web application.  It would be nice if the gather extended browser
info support in Wicket supported these properties.

I'm just curious how others have managed to answer the question, "Does my
browser and version support HTML 5 Local Storage?", from Wicket code.

Thanks,
J.D.







On 11/12/12 7:59 AM, "Phillips, David" <Da...@usaa.com> wrote:

>I would suggest taking a look at Modernizr (http://modernizr.com/) for
>feature detection.
>
>Thanks,
>-David Phillips - USAA
>
>-----Original Message-----
>From: Corbin, James [mailto:jcorbin@iqnavigator.com]
>Sent: Monday, November 12, 2012 8:40 AM
>To: users@wicket.apache.org
>Subject: EXTERNAL: Detecting HTML 5 Features in Wicket
>
>Is there any built in support for detecting HTML 5 browser features like
>Web Storage?
>
>If not, what is  the recommended approach for doing so?
>
>I'm looking for a way to detect support for Web (e.g. Local) Storage, so
>in cases where the browser's do not support it (e.g., IE7), I can use
>cookies or some other mechanism instead.
>
>Thanks,
>
>J.D.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Detecting HTML 5 Features in Wicket

Posted by "Phillips, David" <Da...@usaa.com>.
I would suggest taking a look at Modernizr (http://modernizr.com/) for feature detection.

Thanks,
-David Phillips - USAA

-----Original Message-----
From: Corbin, James [mailto:jcorbin@iqnavigator.com] 
Sent: Monday, November 12, 2012 8:40 AM
To: users@wicket.apache.org
Subject: EXTERNAL: Detecting HTML 5 Features in Wicket

Is there any built in support for detecting HTML 5 browser features like Web Storage?

If not, what is  the recommended approach for doing so?

I'm looking for a way to detect support for Web (e.g. Local) Storage, so in cases where the browser's do not support it (e.g., IE7), I can use cookies or some other mechanism instead.

Thanks,

J.D.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org