Skip to content

Commit 9d88967

Browse files
sgiehlcaddoo
andauthored
Suppress errors when trying to access javaEnabled property (#23161)
Co-authored-by: caddoo <[email protected]>
1 parent 59d8fa4 commit 9d88967

File tree

4 files changed

+117
-113
lines changed

4 files changed

+117
-113
lines changed

js/piwik.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -3418,11 +3418,15 @@ if (typeof window.Matomo !== 'object') {
34183418
// Safari and Opera
34193419
// IE6/IE7 navigator.javaEnabled can't be aliased, so test directly
34203420
// on Edge navigator.javaEnabled() always returns `true`, so ignore it
3421-
if (!((new RegExp('Edge[ /](\\d+[\\.\\d]+)')).test(navigatorAlias.userAgent)) &&
3422-
typeof navigator.javaEnabled !== 'unknown' &&
3423-
isDefined(navigatorAlias.javaEnabled) &&
3424-
navigatorAlias.javaEnabled()) {
3425-
browserFeatures.java = '1';
3421+
try {
3422+
if (!((new RegExp('Edge[ /](\\d+[\\.\\d]+)')).test(navigatorAlias.userAgent)) &&
3423+
typeof navigator.javaEnabled !== 'unknown' &&
3424+
isDefined(navigatorAlias.javaEnabled) &&
3425+
navigatorAlias.javaEnabled()) {
3426+
browserFeatures.java = '1';
3427+
}
3428+
} catch (ignore) {
3429+
// suppress error
34263430
}
34273431

34283432
if (!isDefined(windowAlias.showModalDialog) && isDefined(navigatorAlias.cookieEnabled)) {

0 commit comments

Comments
 (0)