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. Required fields are marked *

Most Popular Posts

Learn about InnoDB MySQL Storage Engine

Posted on 6 years ago

Bhumi

Introduction to PDO in PHP

Posted on 2 years ago

Bhumi

MySQL REGEXP Operator

Posted on 11 months ago

Bhumi

Overview of ECMAScript 6 new Features

Updated 18 years ago

Bhumi

Getting started with Amazon Web Services

Updated 18 years ago

Bhumi

Facade implementation in Laravel

Updated 18 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi