From 9eaeb0f91788b024a80d6a9b43e6eeef096cea66 Mon Sep 17 00:00:00 2001 From: "P. Douglas Reeder" Date: Mon, 30 Sep 2024 11:31:57 -0400 Subject: [PATCH] tracked-controls: specific warning messages when gamepad access is blocked --- src/systems/tracked-controls-webvr.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/systems/tracked-controls-webvr.js b/src/systems/tracked-controls-webvr.js index d104bb3601c..646eb2cc50c 100644 --- a/src/systems/tracked-controls-webvr.js +++ b/src/systems/tracked-controls-webvr.js @@ -65,7 +65,11 @@ module.exports.System = registerSystem('tracked-controls-webvr', { } } catch (e) { if (e.name === 'SecurityError') { - console.warn('A-Frame requires additional permissions to list the gamepads. If this is running in an IFRAME, you need to add `gamepads` to the `allow` attribute. If this is running as the top-level page, the HTTP `Permissions-Policy` header must not exclude this origin in the `gamepad` directive.', e); + if (window.self === window.top) { + console.warn('A-Frame requires additional permissions to list the gamepads. The HTTP `Permissions-Policy` header must not exclude this origin in the `gamepad` directive.', e); + } else { + console.warn('A-Frame requires additional permissions to list the gamepads. The iframe `allow` attribute must not block this origin.', e); + } } else { console.error('Can\'t update controller list:', e); }