File tree 1 file changed +10
-5
lines changed
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');
34
34
var tablet = isTablet ( ) ;
35
35
36
36
function 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 ;
39
44
40
45
var result = isMobile ( {
41
- ua : userAgent ,
46
+ ua : ua ,
42
47
tablet : true
43
48
} ) ;
44
49
45
50
// handle iPad pro or iPad with iOs 13 using Safari
46
51
// see https://github.com/plotly/plotly.js/issues/4502
47
52
if (
48
53
result === false &&
49
- userAgent . indexOf ( 'Macintosh' ) !== - 1 &&
50
- userAgent . indexOf ( 'Safari' ) !== - 1 &&
54
+ ua . indexOf ( 'Macintosh' ) !== - 1 &&
55
+ ua . indexOf ( 'Safari' ) !== - 1 &&
51
56
navigator . maxTouchPoints > 1
52
57
) {
53
58
result = true ;
You can’t perform that action at this time.
0 commit comments