File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -34,20 +34,25 @@ var isMobile = require('is-mobile');
3434var tablet = isTablet ( ) ;
3535
3636function isTablet ( ) {
37- var navigator = window . navigator ;
38- var userAgent = navigator . userAgent ;
37+ var ua ;
38+ // same interface as applied by is-mobile module
39+ if ( ! ua && typeof navigator !== 'undefined' ) ua = navigator . userAgent ;
40+ if ( ua && ua . headers && typeof ua . headers [ 'user-agent' ] === 'string' ) {
41+ ua = ua . headers [ 'user-agent' ] ;
42+ }
43+ if ( typeof ua !== 'string' ) return false ;
3944
4045 var result = isMobile ( {
41- ua : userAgent ,
46+ ua : ua ,
4247 tablet : true
4348 } ) ;
4449
4550 // handle iPad pro or iPad with iOs 13 using Safari
4651 // see https://github.com/plotly/plotly.js/issues/4502
4752 if (
4853 result === false &&
49- userAgent . indexOf ( 'Macintosh' ) !== - 1 &&
50- userAgent . indexOf ( 'Safari' ) !== - 1 &&
54+ ua . indexOf ( 'Macintosh' ) !== - 1 &&
55+ ua . indexOf ( 'Safari' ) !== - 1 &&
5156 navigator . maxTouchPoints > 1
5257 ) {
5358 result = true ;
You can’t perform that action at this time.
0 commit comments