From 8e1165b868bb2882c46b0adf4f6fbdd824e3d441 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Wed, 24 Sep 2025 15:25:57 +0100 Subject: [PATCH 1/2] Add viewport width fix for legacy bundle --- injected/src/features/web-compat.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/injected/src/features/web-compat.js b/injected/src/features/web-compat.js index 956ca2d993..f108bb3bab 100644 --- a/injected/src/features/web-compat.js +++ b/injected/src/features/web-compat.js @@ -141,6 +141,10 @@ export class WebCompat extends ContentFeature { if (this.getFeatureSettingEnabled('enumerateDevices')) { this.deviceEnumerationFix(); } + // Used by Android in the non adsjs version + if (this.getFeatureSettingEnabled('viewportWidthLegacy')) { + this.viewportWidthFix(); + } } /** @@ -151,10 +155,7 @@ export class WebCompat extends ContentFeature { onUserPreferencesMerged(_updatedConfig) { // Re-apply viewport width fix if viewport settings might have changed if (this.getFeatureSettingEnabled('viewportWidth')) { - if (!this._viewportWidthFixApplied) { - this.viewportWidthFix(); - this._viewportWidthFixApplied = true; - } + this.viewportWidthFix(); } } @@ -698,6 +699,10 @@ export class WebCompat extends ContentFeature { } viewportWidthFix() { + if (this._viewportWidthFixApplied) { + return; + } + this._viewportWidthFixApplied = true; if (document.readyState === 'loading') { // if the document is not ready, we may miss the original viewport tag document.addEventListener('DOMContentLoaded', () => this.viewportWidthFixInner()); From 17c4ac95083fdca54a0d051cf97290e0c01c2744 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Wed, 24 Sep 2025 16:02:15 +0100 Subject: [PATCH 2/2] Explain the change more and disable it by default --- injected/src/features/web-compat.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/injected/src/features/web-compat.js b/injected/src/features/web-compat.js index f108bb3bab..f2f1521f88 100644 --- a/injected/src/features/web-compat.js +++ b/injected/src/features/web-compat.js @@ -142,7 +142,8 @@ export class WebCompat extends ContentFeature { this.deviceEnumerationFix(); } // Used by Android in the non adsjs version - if (this.getFeatureSettingEnabled('viewportWidthLegacy')) { + // This has to be enabled in the config for the injectName='android' now. + if (this.getFeatureSettingEnabled('viewportWidthLegacy', 'disabled')) { this.viewportWidthFix(); } } @@ -150,6 +151,7 @@ export class WebCompat extends ContentFeature { /** * Handle user preference updates when merged during initialization. * Re-applies viewport fixes if viewport configuration has changed. + * Used in the injectName='android-adsjs' instead of 'viewportWidthLegacy' from init. * @param {object} _updatedConfig - The configuration with merged user preferences */ onUserPreferencesMerged(_updatedConfig) {