mmikkel / Detect-Craft

Craft CMS wrapper for the Mobile_Detect library
MIT License
26 stars 3 forks source link

craft.request.isMobileBrowser() vs. this plugin #2

Closed kaspar-allenbach closed 6 years ago

kaspar-allenbach commented 7 years ago

I just learned about {% if craft.request.isMobileBrowser() %}. Do you know the difference between this and your plugin? Is it just using another library?

mmikkel commented 6 years ago

Hi @kaspar-allenbach, sorry for ignoring your issue. craft.request.isMobileBrowser doesn't leverage a library, just some regex to parse the client's user-agent to test for the most common mobile browsers. If all you need is to know if a request is coming from a mobile (phone or phone/tablet), craft.request.isMobileBrowser would do the job for you in most cases.

Detect, which uses the excellent Mobile_Detect library, is basically much more powerful in terms of available tests and functionality, it's probably more reliable for more browsers/user agents, etc. That's basically it :)