Is there a fool-proof regex (I'm using PHP) to match the Microsoft Edge user agent string?
Microsoft Edge UA string:2171.71 Safari/537.36 Edge/12.0″.
AppleWebKit/537.36 indicates what browser rendering engine is used. A rendering engine is what transforms HTML into an interactive webpage on the user's screen. The WebKit browser engine was developed by Apple and is primarily used by Safari, Chromium, and all other WebKit-based browsers. (KHTML, like Gecko).
Press Ctrl + Shift + P (Windows, Linux) or Command + Shift + P (macOS) to open the Command Menu. Type network conditions , select Show Network conditions, and then press Enter to open the Network conditions tool. In the User agent section, clear the Use browser default checkbox.
The User-Agent (UA) string is contained in the HTTP headers and is intended to identify devices requesting online content. The User-Agent tells the server what the visiting device is (among many other things) and this information can be used to determine what content to return.
As well most browsers you can simply just say the browser name in the comparison string as shown below.
$user_agent = $_SERVER['HTTP_USER_AGENT'];
preg_match('/Edge/i', $user_agent)
This worked for me. Hope it does for you too.
I would HIGHLY recommend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With