@@ -141,20 +141,23 @@ export class WebCompat extends ContentFeature {
141141 if ( this . getFeatureSettingEnabled ( 'enumerateDevices' ) ) {
142142 this . deviceEnumerationFix ( ) ;
143143 }
144+ // Used by Android in the non adsjs version
145+ // This has to be enabled in the config for the injectName='android' now.
146+ if ( this . getFeatureSettingEnabled ( 'viewportWidthLegacy' , 'disabled' ) ) {
147+ this . viewportWidthFix ( ) ;
148+ }
144149 }
145150
146151 /**
147152 * Handle user preference updates when merged during initialization.
148153 * Re-applies viewport fixes if viewport configuration has changed.
154+ * Used in the injectName='android-adsjs' instead of 'viewportWidthLegacy' from init.
149155 * @param {object } _updatedConfig - The configuration with merged user preferences
150156 */
151157 onUserPreferencesMerged ( _updatedConfig ) {
152158 // Re-apply viewport width fix if viewport settings might have changed
153159 if ( this . getFeatureSettingEnabled ( 'viewportWidth' ) ) {
154- if ( ! this . _viewportWidthFixApplied ) {
155- this . viewportWidthFix ( ) ;
156- this . _viewportWidthFixApplied = true ;
157- }
160+ this . viewportWidthFix ( ) ;
158161 }
159162 }
160163
@@ -698,6 +701,10 @@ export class WebCompat extends ContentFeature {
698701 }
699702
700703 viewportWidthFix ( ) {
704+ if ( this . _viewportWidthFixApplied ) {
705+ return ;
706+ }
707+ this . _viewportWidthFixApplied = true ;
701708 if ( document . readyState === 'loading' ) {
702709 // if the document is not ready, we may miss the original viewport tag
703710 document . addEventListener ( 'DOMContentLoaded' , ( ) => this . viewportWidthFixInner ( ) ) ;
0 commit comments