go/http/http.go

12 lines
249 B
Go

package http
import (
"net/http"
"strings"
)
func IsMobile(r *http.Request) bool {
return (strings.Contains(strings.ToLower(r.Header.Get("User-Agent")), "android") ||
strings.Contains(strings.ToLower(r.Header.Get("User-Agent")), "iphone"))
}