Skip to content

Commit 8e1165b

Browse files
Add viewport width fix for legacy bundle
1 parent 5431bb6 commit 8e1165b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

injected/src/features/web-compat.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export class WebCompat extends ContentFeature {
141141
if (this.getFeatureSettingEnabled('enumerateDevices')) {
142142
this.deviceEnumerationFix();
143143
}
144+
// Used by Android in the non adsjs version
145+
if (this.getFeatureSettingEnabled('viewportWidthLegacy')) {
146+
this.viewportWidthFix();
147+
}
144148
}
145149

146150
/**
@@ -151,10 +155,7 @@ export class WebCompat extends ContentFeature {
151155
onUserPreferencesMerged(_updatedConfig) {
152156
// Re-apply viewport width fix if viewport settings might have changed
153157
if (this.getFeatureSettingEnabled('viewportWidth')) {
154-
if (!this._viewportWidthFixApplied) {
155-
this.viewportWidthFix();
156-
this._viewportWidthFixApplied = true;
157-
}
158+
this.viewportWidthFix();
158159
}
159160
}
160161

@@ -698,6 +699,10 @@ export class WebCompat extends ContentFeature {
698699
}
699700

700701
viewportWidthFix() {
702+
if (this._viewportWidthFixApplied) {
703+
return;
704+
}
705+
this._viewportWidthFixApplied = true;
701706
if (document.readyState === 'loading') {
702707
// if the document is not ready, we may miss the original viewport tag
703708
document.addEventListener('DOMContentLoaded', () => this.viewportWidthFixInner());

0 commit comments

Comments
 (0)