Detecting MS Edge with hisorange/browser-detect in PHP

不想你离开。 提交于 2020-01-17 15:28:07

问题


I am trying to detect Microsoft Edge using hisorange/browser-detect package in my Laravel 5.2 project.

As I understand, I should merely write Browser::isIE() to detect Internet Explorer and Edge, but unfortunately it shows only Internet Explorer.


回答1:


According to the developers you have to check for Microsoft Edge like this:

Browser::isIE(true);

This will include the Trident into the matching.

It was not added originally because the Trident is not a traditional IE update.

In order to detect Microsoft edge yourself just do:

$user_agent = $_SERVER['HTTP_USER_AGENT']; 
preg_match('/Edge/i', $user_agent)


来源:https://stackoverflow.com/questions/48096786/detecting-ms-edge-with-hisorange-browser-detect-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!