I have an issue where an external iFrame I am loading using Javascript displays fine on iOS, Android and Windows, but doesn't display on Mac Chrome, Firefox or Edge.
Using Chrome Inspector, I can see the reason why it doesn't display is because height is set to 0px. If you resize the browser window, the iFrame then displays, as if Chrome is nudged into resizing the iFrame.
My thinking is to force the iFrame's height, that way it will be displayed no matter what.
I am fairly new to JS, so could someone recommend what that code might look like?
Force Height of External iFrame
in JavaScript
Posted
Hello everyone,
I have an issue where an external iFrame I am loading using Javascript displays fine on iOS, Android and Windows, but doesn't display on Mac Chrome, Firefox or Edge.
Using Chrome Inspector, I can see the reason why it doesn't display is because height is set to 0px. If you resize the browser window, the iFrame then displays, as if Chrome is nudged into resizing the iFrame.
My thinking is to force the iFrame's height, that way it will be displayed no matter what.
I am fairly new to JS, so could someone recommend what that code might look like?
Below is my code (a Shopify Buy Button):
Below is the resulting iFrame rendered in browser:
Below is the full code as it's rendered in browser:
Many thanks