Wrap app.isMobile in try/catch

pull/165/head
Thibaut 10 years ago
parent d570f7866b
commit e21ac0589c

@ -191,11 +191,14 @@
!!(@DOC or @doc)
isMobile: ->
# Need to sniff the user agent because some Android and Windows Phone devices don't take
# resolution (dpi) into account when reporting device width/height.
@_isMobile ?= (matchMedia('(max-device-width: 767px), (max-device-height: 767px)').matches) or
(navigator.userAgent.indexOf('Android') isnt -1 and navigator.userAgent.indexOf('Mobile') isnt -1) or
(navigator.userAgent.indexOf('IEMobile') isnt -1)
try
# Need to sniff the user agent because some Android and Windows Phone devices don't take
# resolution (dpi) into account when reporting device width/height.
@_isMobile ?= (window.matchMedia('(max-device-width: 767px), (max-device-height: 767px)').matches) or
(navigator.userAgent.indexOf('Android') isnt -1 and navigator.userAgent.indexOf('Mobile') isnt -1) or
(navigator.userAgent.indexOf('IEMobile') isnt -1)
catch
@_isMobile = false
isInvalidLocation: ->
@config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0

Loading…
Cancel
Save