mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Fix iPad Detection
This commit is contained in:
parent
81de9803da
commit
470460d8cb
1 changed files with 15 additions and 1 deletions
|
|
@ -1,10 +1,24 @@
|
|||
// Copyright (C) 2017-2022 Smart code 203358507
|
||||
|
||||
// this detects ipad properly in safari
|
||||
// while bowser does not
|
||||
function iOS() {
|
||||
return [
|
||||
'iPad Simulator',
|
||||
'iPhone Simulator',
|
||||
'iPod Simulator',
|
||||
'iPad',
|
||||
'iPhone',
|
||||
'iPod'
|
||||
].includes(navigator.platform)
|
||||
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document);
|
||||
}
|
||||
|
||||
const Bowser = require('bowser');
|
||||
|
||||
const browser = Bowser.parse(window.navigator?.userAgent || '');
|
||||
|
||||
const name = (browser?.os?.name || 'unknown').toLowerCase();
|
||||
const name = iOS() ? 'ios' : (browser?.os?.name || 'unknown').toLowerCase();
|
||||
|
||||
module.exports = {
|
||||
name,
|
||||
|
|
|
|||
Loading…
Reference in a new issue