Mobile-Detect for NGINX | Lua

If you’re using NGINX and you want to detect mobile devices, I just finished a loose port of Mobile-Detect to Lua brilliantly named mobile-detect.lua.

The script detects the device by comparing patterns against a given User-Agent string.
The following device information is available:

  • mobile or not
  • if mobile, whether phone or tablet
  • operating system
  • Mobile Grade (A, B, C)
  • specific versions (e.g. WebKit)

The script is documented and fully unit tested.

Requirements:

Usage:

Script:
mobile-detect.lua

About the author

Mark

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *