Skip to content

Commit

Permalink
Use window.ontouchstart to detect Safari on iPad.
Browse files Browse the repository at this point in the history
  • Loading branch information
denschub authored and alexgibson committed Jun 30, 2023
1 parent 045002c commit c7a7012
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion media/js/base/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
pf.indexOf('iPhone') !== -1 ||
pf.indexOf('iPad') !== -1 ||
pf.indexOf('iPod') !== -1 ||
(pf.indexOf('MacIntel') !== -1 && 'standalone' in navigator)
(pf.indexOf('MacIntel') !== -1 && 'ontouchstart' in window)
) {
// iPadOS
return 'ios';
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/spec/base/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('site.js', function () {
});

it('should identify iPadOS', function () {
window.navigator.standalone = sinon.stub();
window.ontouchstart = sinon.stub();
expect(window.site.getPlatform('foo', 'MacIntel')).toBe('ios');
});

Expand Down

0 comments on commit c7a7012

Please sign in to comment.