some clients doesn't look like they send an user agent

This commit is contained in:
nilsding 2014-12-08 12:11:20 +01:00
parent afe9b8f743
commit bda7a9f699
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ module ApplicationHelper
end
def ios_web_app?
user_agent = request.env['HTTP_USER_AGENT']
user_agent = request.env['HTTP_USER_AGENT'] || 'Mozilla/5.0'
# normal MobileSafari.app UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B435 Safari/600.1.4
# webapp UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435
return true if user_agent.match /^Mozilla\/\d+\.\d+ \(i(?:Phone|Pad|Pod); CPU(?:.*) like Mac OS X\)(?:.*) Mobile(?:\S*)$/