Hello Community - We are detecting the user-agent(Desktop/Mobile/Tablet) using WCMUsePojo and based on the user-agent, we are showing the appropriate content in HTL. It is working only for Mobile but when we use "Tablet", it is not working. Can you let me how to retrieve it for tablet?
public void activate() throws Exception {
setMobile(getRequest().getHeader("User-Agent").indexOf("Mobile") != -1 ? Boolean.TRUE: Boolean.FALSE);
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @v1101,
Unlike Mobile, there is no generic name for Tablets in User-Agent Header. For iPad, you can make use of the string "iPad"
Below site has the list of all possible User-Agent values for Tablet. If you have specific list of supported devices, you can write condition accordingly
As an alternative, there are several other options available for device specific logic.
Could you please brief about your component functionality.
Hi @v1101,
Unlike Mobile, there is no generic name for Tablets in User-Agent Header. For iPad, you can make use of the string "iPad"
Below site has the list of all possible User-Agent values for Tablet. If you have specific list of supported devices, you can write condition accordingly
As an alternative, there are several other options available for device specific logic.
Could you please brief about your component functionality.
Views
Replies
Total Likes
Hi @v1101,
Thanks for the details.
You can make use of Core Image component which is an Adaptive Image component that offers responsive features with lazy loading.
In the design dialog of the component, we have an option to mention all possible width and component will then load the respective width based on the size of the window.
More about this in below docs
If you can't switch component, another option is to use JS to handle device specific image path(src)
Frame the HTL with actual image path -> Amend the src based on the device in JS. Something like below can be tried.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies