Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnePlus Open Incorrectly Identified as Tablet in Chrome #7802

Closed
jehkiT opened this issue Aug 28, 2024 · 4 comments
Closed

OnePlus Open Incorrectly Identified as Tablet in Chrome #7802

jehkiT opened this issue Aug 28, 2024 · 4 comments

Comments

@jehkiT
Copy link

jehkiT commented Aug 28, 2024

Description:

I'm encountering an issue where a OnePlus Open, a foldable phone device, is being incorrectly identified as a tablet in the Chrome browser. This is causing compatibility issues and preventing certain features from functioning properly.

Expected Behavior:

The device should be recognized as a phablet, given its form factor and capabilities.

Actual Behavior:

The device is recognized as a tablet.

The following methods and their JSON outputs confirm the incorrect identification:

$dd = new DeviceDetector($_SERVER['HTTP_USER_AGENT'] ?? "", ClientHints::factory($_SERVER));
$dd->setCache(new PSR6Bridge(new ApcuAdapter()));
$dd->parse();
$hints = $dd->getClientHints();

echo json_encode($dd->getUserAgent(), JSON_UNESCAPED_SLASHES); // prints "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
echo json_encode($dd->isBot(), JSON_UNESCAPED_SLASHES); // prints false
echo json_encode($dd->getClient(), JSON_UNESCAPED_SLASHES); // prints {"type":"browser","name":"Chrome","short_name":"CH","version":"128.0","engine":"Blink","engine_version":"128.0.0.0","family":"Chrome"}
echo json_encode($dd->isPhablet(), JSON_UNESCAPED_SLASHES); // prints false
echo json_encode($dd->isMobile(), JSON_UNESCAPED_SLASHES); // prints true
echo json_encode($dd->isMobileApp(), JSON_UNESCAPED_SLASHES); // prints false
echo json_encode($dd->isTablet(), JSON_UNESCAPED_SLASHES); // prints true
echo json_encode($hints->getApp(), JSON_UNESCAPED_SLASHES); // prints ""
echo json_encode($hints->getModel(), JSON_UNESCAPED_SLASHES); // prints ""
echo json_encode($hints->getArchitecture(), JSON_UNESCAPED_SLASHES); // prints ""
echo json_encode($hints->getBitness(), JSON_UNESCAPED_SLASHES); // prints ""
echo json_encode($hints->getBrandList(), JSON_UNESCAPED_SLASHES); // prints {"Chromium":"128","Not;A=Brand":"24","Google Chrome":"128"}
echo json_encode($hints->getOperatingSystem(), JSON_UNESCAPED_SLASHES); // prints "Android"
echo json_encode($hints->getOperatingSystemVersion(), JSON_UNESCAPED_SLASHES); // prints ""

Request:

I kindly request assistance in resolving this issue. Any suggestions or workarounds would be greatly appreciated.

@matomo-org matomo-org deleted a comment Aug 28, 2024
@liviuconcioiu
Copy link
Collaborator

liviuconcioiu commented Aug 28, 2024

Can you check on http://devicedetector.net/ if the device is detected correctly? You have to click on Consider Client Hints (JSON or Headers) and Detect.

From what I see, there's no brand/model, and without this information it fallsback to tablet, because of the user-agent.

@matomo-org matomo-org deleted a comment Aug 28, 2024
@matomo-org matomo-org deleted a comment Aug 28, 2024
@jehkiT
Copy link
Author

jehkiT commented Aug 28, 2024

Can you check on http://devicedetector.net/ if the device is detected correctly? You have to click on Consider Client Hints (JSON or Headers) and Detect.

From what I see, there's no brand/model, and without this information it fallsback to tablet, because of the user-agent.

Unfortunately, I don't have access to a OnePlus Open device myself. This report is based on feedback received from a user of my web service.

To help diagnose the issue further, I've requested the user to visit http://devicedetector.net/ and provide the "raw data" section of the JSON output generated there. Alternatively, a screenshot of that section would also be helpful.

@liviuconcioiu
Copy link
Collaborator

@jehkiT do you request the client hints from browser using header?

header('Accept-CH: Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Arch, Sec-CH-UA-Model, Sec-CH-UA-Form-Factors, Sec-CH-UA-Bitness, Sec-CH-UA-WoW64');

If not, then this might be the reason why the detection isn't working.

@liviuconcioiu
Copy link
Collaborator

Fixed in aab8aa0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants