There is a webpage which shows different design according to the screen size (whenever you refresh the page after changing the screen size). I have embedded this webpage in my website. However, after embedding, it is unable to show different designs according to the screen size (even after refreshing the page).
The iframe is unable to detect the screen size or the device type. For simplicity, I have separated the iframe from my website. Here is the simplified iframe:
<iframe iframe width="770" height="1000" src="http://tanzil.net/?embed=true&defTrans=ur.jawadi" style="overflow-x:hidden; overflow-y:auto;" scrolling="no" frameborder="0"></iframe>
I have created a video to demonstrate the problem in case you are unable to understand it. In the earlier part of the video, I have shown how the webpage (that is to be embedded) behaves normally. Then, in the second part of the video, I have embedded the same webpage in an iframe and now it does not behave normally (it does not change the design according to the screen size even after refreshing the page). Is there any way I can tell the iframe the device type, or tell it behave normally (just like it was not embedded)? Is there any method to fool the iframe into thinking that it is not being embedded so that it doesn't cause any problems?
EDIT: An answer suggests to set the width to be a percentage value, normally 100%, so that the iframe can flex in size with the parent page. Even if I do so, it does not work:
<div id="iframe-container" style="position: relative; width: 100%; height: 1000vh;">
<iframe width="100%" height="100%" src="https://tanzil.net/?embed=true&defTrans=ur.jawadi" style="overflow-x:hidden; overflow-y:auto;" scrolling="no" frameborder="0" id="quraniframe">
</iframe>
</div>
Response to another answer:
- Adding the viewport meta tag also doesn't help
- The webpage I am embedding is responsive because when opened separately, no issue is faced. As soon as the webpage is embedded, the problems can be seen.
- The hosting server allows the content to be embedded. In fact, the webpage I am embedding is especially designed to be embedded.
- I have shown the testing in the video. When not embedded in the iframe, it is responsive. When embedded in the iframe, it is not responsive anymore (because it is not understanding that the iframe is being resized)
<meta name="viewport" content="width=768">
. If I emulate a mobile device (iPhone 12 Pro) however and then load the page, I get<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
. But inside the iframe, it also sayscontent="width=768"
- and therefor does not behave responsive in there.