Title
Brave Shields modifies window.screenX, window.screenY, window.outerWidth, and window.outerHeight, causing incorrect window coordinates to be reported
Summary
When Brave Shields is enabled on YouTube, JavaScript APIs such as:
window.screenX
window.screenY
window.outerWidth
window.outerHeight
return incorrect values that do not correspond to the actual browser window position and size.
When Shields is disabled for the same page, the returned values immediately become correct and match the values obtained from the Win32 API (GetWindowRect).
This behavior breaks applications that rely on accurate browser window coordinates.
Environment
- Browser: Brave
- Site: YouTube
- OS: Windows
- Script Manager: Tampermonkey (but issue reproduces without Tampermonkey)
- Shields: ON (issue occurs)
- Shields: OFF (issue disappears)
Steps to Reproduce
- Open Brave.
- Ensure Shields are enabled for YouTube.
- Open any YouTube video.
- Open DevTools (F12).
- Run the following code in the Console:
console.log({
screenX: window.screenX,
screenY: window.screenY,
outerWidth: window.outerWidth,
outerHeight: window.outerHeight,
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
visualWidth: window.visualViewport?.width,
visualHeight: window.visualViewport?.height
});
- Move the Brave window to a visibly different location on the desktop.
- Run the same code again.
Actual Result
The values remain approximately:
screenX: 5
screenY: 5
outerWidth: 982
outerHeight: 620
even after moving the browser window.
Example:
screenX: 5
screenY: 5
outerWidth: 982
outerHeight: 620
Window moved to a different monitor:
screenX: 5
screenY: 5
outerWidth: 982
outerHeight: 620
The values do not reflect the actual window position.
Expected Result
The values should change when the browser window moves.
Example:
screenX: 379
screenY: 54
outerWidth: 1235
outerHeight: 891
Verification
With Shields disabled on the same page:
console.log({
screenX: window.screenX,
screenY: window.screenY,
outerWidth: window.outerWidth,
outerHeight: window.outerHeight
});
returns:
screenX: 379
screenY: 54
outerWidth: 1235
outerHeight: 891
These values exactly match the Win32 API result:
Left = 379
Top = 54
Width = 1235
Height = 891
obtained using GetWindowRect().
Additional Notes
- The issue reproduces directly in Brave DevTools Console.
- Tampermonkey is not required for reproduction.
- The same JavaScript code works correctly in Microsoft Edge.
- The behavior appears to be related to Brave Shields and/or fingerprinting protection.
Question
Is this behavior intentional fingerprinting protection, or is it a bug?
If intentional, is there documentation describing which Window APIs are modified and whether a per-site exception can be configured?