Retrieving the user-agent for Tablet

Avatar

Avatar
Validate 10
Level 2
v1101
Level 2

Likes

4 likes

Total Posts

150 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 10
Level 2
v1101
Level 2

Likes

4 likes

Total Posts

150 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 1
Give Back 5
Give Back 3
View profile
v1101
Level 2

10-09-2020

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);

}

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

572 likes

Total Posts

716 posts

Correct reply

238 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

572 likes

Total Posts

716 posts

Correct reply

238 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile
Vijayalakshmi_S
MVP

10-09-2020

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.

Answers (0)