cytsunny
cytsunny

Reputation: 5030

How to detect if it is a desktop device using the DeviceDetector php library?

I am using this library to detect the device and client program from the http user agent string.

Device Detector

On the library's demo page, they are able to distinguish if the device is a desktop or smartphone even if the device model is not detected. However, they don't have a document to state what function they have use to do that. On the read me on github, I guessed it is $dd->getDevice(), but it seems that function only return an integer 1 or 0 (and I have no idea what does it means)

They didn't provide the source code for the demo page, and there are no further documentation other than the read me page. Anybody know what is the function they are using to detect if it is smartphone or desktop on the demo page?

Upvotes: -3

Views: 304

Answers (1)

Scuzzy
Scuzzy

Reputation: 12322

in the file DeviceDetector.php there is a function isDesktop() with the following statement

/**
 * Returns if the parsed UA was identified as desktop device
 * Desktop devices are all devices with an unknown type that are running a desktop os
 *
 * @see self::$desktopOsArray
 *
 * @return bool
 */
public function isDesktop()

Upvotes: 1

Related Questions