suncat2000 / MobileDetectBundle

Symfony 2/3/4 bundle for detect mobile devices, manage mobile view and redirect to the mobile and tablet version.
397 stars 153 forks source link

Check browser in Twig #136

Open diriy opened 4 years ago

diriy commented 4 years ago

How is it possible to check which browser is used in Twig? It is written that it is possible in php code but I couldn't find a proper Twig filter for it:

$mobileDetector->isChrome();
$mobileDetector->isSafari();

How can I check if it is Mozilla Firefox in Twig?

Snowbell92 commented 4 years ago

extend the extension, or return a variable from your controller. I only need to check in one place and one browser, so I am returning a variable from controller.