detectmobile

package module
v0.0.0-...-61a133d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2014 License: MIT Imports: 3 Imported by: 0

README

detectmobile wercker status

Martini middleware/handler for detecting mobile device by HTTP headers. This middleware will check User-Agent and Accept headers and will set X-Mobile-Device header to true/false.

Usage

package main

import (
    "github.com/go-martini/martini"
    "github.com/mytrile/detectmobile"
)

func main() {
    m := martini.Classic()
    m.Use(detectmobile.DetectMobile())
    m.Get("/", func(mobileDevice string) string {
      // mobileDevice will be true/false depending on detection
      return "Hello world!"
    })
    m.Run()
}

Meta

Documentation

Index

Constants

View Source
const (
	X_HEADER = "X-MOBILE-DEVICE"
)

Variables

This section is empty.

Functions

func DetectMobile

func DetectMobile() martini.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL