Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get useragent in controller magento?

Tags:

magento

I need to get full infomation of user agent in controller magento. Is there the way to get it?

like image 605
Hien Tran Avatar asked Sep 17 '11 08:09

Hien Tran


People also ask

How to create a controller in Magento 2?

How to create a controller in Magento 2? Step 1: Create routes.xml file. _forward () and _redirect () action. Controller specially is one of the important thing in Module development series, and PHP MVC Framework in general. It functionarity is that received request, process and render page.

How do I restrict access to a specific user in Magento 2?

Adding a new ACL By creating a new ACL (Access Control List) we can limit the access to our new controller, allowing only certain groups of users (roles) to have access to its contents. By default, Magento 2 has only one admin role – Administrators.

How to add security keys to URLs in Magento backend?

Log-in to your Magento backend and go to Stores > Configuration > Advanced > Admin > Security . Set the option Add security keys to URLs as no. Now we just need to run the command php bin/magento cache:clean to clear the cache and our new controller should be accessible. This is how Magento builds the URLs for backend controllers:

Should I use objectmanager in Magento?

Try not to use Objectmanager. It is just for fast implementation Vote this answer up if it helps. Thanks for contributing an answer to Magento Stack Exchange! Please be sure to answer the question. Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers.


1 Answers

Mage::helper('core/http')->getHttpUserAgent()

Internally it is just accessing $_SERVER as you would normally but also does some character encoding stuff. Using this way allows other modules/developers to modify the returned value, which makes it future proof.

like image 140
clockworkgeek Avatar answered Oct 19 '22 09:10

clockworkgeek