Back to Top

How to detect browser in Joomla

Browser Detection with Joomla

Nowadays almost all people use the mobile devices to access the internet so now many of the websites you can see in responsive which detect the mobile device and load layout as per that.

Well,sometimes you want to load some PHP code only on mobile devices and there are multiple ways in a Joomla to respond a visitor when mobile device detected like many extensions available for free download that help to create mobile compatible version of a Joomla.

So, Today I am going to explain how to detect mobile device using Joomla libraries rather than using any extensions because of using Joomla we can take advantage of built-in browser detection class of Joomla.

First of all, if you are using any external file then you need to load Joomla framework inside that file

So ,let’s see the code:

Now, first you need to use jimport() to get it into availability of the JBrowser class which is located in Joomla’s class library, in the environment sub package and then use the JBrowser class method in the Joomla framework to detect the browser.

Then you need to get an instance of the browser object

As you can see, it’s very simple.I hope this little tutorial helps you with how to use browser detection built-in library into Joomla.Again if you have any questions just drop me a comment. So that’s all for now.
Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (2)

  1. why not use this API : http://www.ducis.net/Miri ? It’s much more detailed, accurate, up-to-date and faster. 😉

  2. I am not sure about this API and this is about how we use in built library provided by Joomla.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

WordPress Template Hierarchy Tutorial

Posted on 8 years ago

Bhumi

Overview of Amazon Web Services (AWS)

Posted on 7 years ago

Bhumi

How to use Transient API in WordPress

Posted on 9 years ago

Bhumi