The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20120525

jsf 1.2 and richfaces 3 - get screen dimensions and browser info



here's how to get common browsing details like screen height and width, which browser the user is using and what language the browser has, using jsf 1.2 and richfaces 3:

<a4j:commandButton value="#{myBean.getPropertyValue('label.login')}"
action="#{myBean.login}">
<a4j:actionparam name="w" value="screen.width"
assignTo="#{myBean.screenWidth}" noEscape="true" />
<a4j:actionparam name="h" value="screen.height"
assignTo="#{myBean.screenHeight}" noEscape="true" />
<a4j:actionparam name="c" value="navigator.cookieEnabled"
assignTo="#{myBean.cookieEnabled}" noEscape="true" />
<a4j:actionparam name="a" value="navigator.userAgent"
assignTo="#{myBean.userAgent}" noEscape="true" />
<a4j:actionparam name="l" value="navigator.language"
assignTo="#{myBean.browserLanguage}" noEscape="true" />
<a4j:actionparam name="p" value="navigator.platform"
assignTo="#{myBean.platform}" noEscape="true" />
</a4j:commandButton>

No comments:

Post a Comment