Forum Discussion
stephen1
Nimbostratus
Mar 17, 2014Detect mobile device use iRule
dear All,
I seem to be spinning my wheels here and I am not sure why. I want to do the following:
1.Detect if a user is coming from a mobile device
Redirect the user to a mobile optimized sit...
Ashish_Ram_Tak1
Nimbostratus
Mar 18, 2014Hello Stephen,
You can try below iRule, I have same kind of requirement and the below iRule is working fine.
when HTTP_REQUEST { set uri [string tolower [HTTP::uri] ]
set mobile_site "http://m.mydomain.com"
set full_site "http://www.mydomain.com"
switch -glob [string tolower [HTTP::header User-Agent]] {
"*iphone*" -
"*android*" -
"*windows phone*" -
"*windows ce*" -
"*bada*" -
"*bb10*" -
"*blackberry*" -
"*symbinos*" -
"*symbain os*" -
"*symbian*" -
"*java*" -
"*winowsphone*" -
"*windowsce*" {
HTTP::redirect "http://m.mydomain.com"
return
}
}
}
Regards, Ashish.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects