8000 feat(feedback): Extra check for iPad in screenshot support (#12593) · n4bb12/sentry-javascript@44ef79a · GitHub
  • [go: up one dir, main page]

    Skip to content

    Commit 44ef79a

    Browse files
    authored
    feat(feedback): Extra check for iPad in screenshot support (getsentry#12593)
    iPads on iPad OS 13+ will show up as Macintosh in the UserAgent since they show the desktop version of sites. This adds extra checks to distinguish if it's an iPad. Fixes [JAVASCRIPT-2TNR](https://sentry.sentry.io/feedback/?feedbackSlug=javascript:5511454761&project=11276)
    1 parent dfa863a commit 44ef79a

    File tree

    1 file changed

    +9
    -0
    lines changed

    1 file changed

    +9
    -0
    lines changed

    packages/feedback/src/util/isScreenshotSupported.ts

    Lines changed: 9 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -17,6 +17,15 @@ export function isScreenshotSupported(): boolean {
    1717
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent)) {
    1818
    return false;
    1919
    }
    20+
    /**
    21+
    * User agent on iPads show as Macintosh, so we need extra checks
    22+
    *
    23+
    * https://forums.developer.apple.com/forums/thread/119186
    24+
    * https://stackoverflow.com/questions/60482650/how-to-detect-ipad-useragent-on-safari-browser
    25+
    */
    26+
    if (/Macintosh/i.test(NAVIGATOR.userAgent) && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 1) {
    27+
    return false;
    28+
    }
    2029
    if (!isSecureContext) {
    2130
    return false;
    2231
    }

    0 commit comments

    Comments
     (0)
    0