GoMobileDetect is a lightweight package imported from PHP for detecting mobile devices including tablets.
The package is imported from MobileDetect which was originally written in PHP.
$ go get github.com/Shaked/gomobiledetect
- Now supports using
Http.Handlerimplementation. See examples
- The package name had been changed to mobiledetect.
-
This version introduces a new method
IsKey(key int). This method is faster than theIs(key string). All keys can be found here -
The
Is(key string)has been changed to support bothstringandintusing theinterface{}.
BenchmarkIsMobile 2000 1001884 ns/op
ok github.com/Shaked/gomobiledetect 7.091s
BenchmarkIsMobile 100000 19278 ns/op
ok github.com/Shaked/gomobiledetect 7.448s
There are different ways of using the package:
- Basic usage
- Basic router implementation
- Handler interface implementation
- Mux interface implementation
Go Mobile Detect is an open-source script released under MIT License.


