Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

How to detect the Edge Browser

How to detect the Edge Browser

Hi Stephen and thanks for a very helpful module.  I only use it on one client site but it's really neat.  wink
Here are my details:
Joomla 3.8.5
metamod v3.27
Recipe: Detecting Browser type

I need to be able to produce a module when the User employs the M/S Edge browser.  It seems that this browser is not on your list of browsers.  I have used metamod successfully for Firefox so I know I have the recipe working correctly but I am guessing you have not either updated the program to include this new browser -- or you haven't updated the help files.

Anyway, is it possible to add this browser to your listing or let me know how to detect Edge?

Thanks,
Randy

randy_r
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: How to detect the Edge Browser

Hi,

I think you can do it this way:

$ua = @$_SERVER['HTTP_USER_AGENT'];
if (strpos($ua, 'Edge/') !== false) {
    echo 'Edge Browser';
}

Note that browser sniffing is officially not a great way to provide content for different browsers. But providing the user agent for Edge browsers continues to contain the string "Edge/" then you're good to go.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10796
Newest User:
mokao3
Members Online:
0
Guests Online:
135

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked