PHP code example of poowaa / browser-detect-standalone
1. Go to this page and download the library: Download poowaa/browser-detect-standalone library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
poowaa / browser-detect-standalone example snippets
use PoOwAa\BrowserDetect\Browser as Browser;
// Determine the user's device type is simple as this:
Browser::isMobile();
Browser::isTablet();
Browser::isDesktop();
// Every wondered if it is a bot who loading your page?
if (Browser::isBot()) {
echo 'No need to wonder anymore!';
}
// Check for vendors.
if (Browser::isFirefox() || Browser::isOpera()) {
$output .= '<script src="firefox-fix.js"></script>';
}
use PoOwAa\BrowserDetect\Parser;
$customBrowser = new PoOwAa\BrowserDetect\Parser('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36');
// Determine the user's device type is simple as this:
$customBrowser->isMobile();
$customBrowser->isTablet();
$customBrowser->isDesktop();
// Every wondered if it is a bot who loading your page?
if ($customBrowser->isBot()) {
echo 'No need to wonder anymore!';
}
// Check for vendors.
if ($customBrowser->isFirefox() || $customBrowser->isOpera()) {
$output .= '<script src="firefox-fix.js"></script>';
}