Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2139

Joomla! 4.x Coding • Re: Migrating code from joomla 3 to joomla 4

$
0
0
You don't need to create a whole new application instance just to read client information. You can use Joomla\Application\Web\WebClient class directly. But in CMS context you can get it through current application instance:

Code:

Joomla\CMS\Factory::getApplication()->client->mobile
There is also Joomla\CMS\Environment\Browser class:

Code:

Joomla\CMS\Environment\Browser::getInstance()->isMobile()
Not sure which one is more reliable in terms of detection.

Statistics: Posted by SharkyKZ — Wed Apr 03, 2024 5:17 am



Viewing all articles
Browse latest Browse all 2139

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>