-2

I have an iframe that is sized to the size of the inner content which is smaller than the viewport. It works without problems on desktop browsers, including desktop Safari. However, on mobile Safari, when the content width is less than 320px, the iframe stays at a width of 320px. How can I make an iframe in mobile Safari to be a width less than 320px?

UPDATE: SOLVED. This had to do with the default setting in the frontend framework (Semantic-UI) that was used, which had a min-width of 320px set on the body tag. Overriding this setting on the body tag solved this issue.

user1647525
  • 311
  • 3
  • 14
  • Is the iframe on the same domain or cross-domain? – Adam Buchanan Smith May 12 '16 at 22:12
  • Possible duplicate of [How to get an IFrame to be responsive in iOS Safari?](http://stackoverflow.com/questions/23083462/how-to-get-an-iframe-to-be-responsive-in-ios-safari) – Adam Buchanan Smith May 12 '16 at 22:15
  • I'm not sure how being same- or cross-domain is relevant in this context? The problem exists either way. I have control over the content of the iframe and the parent. The question is not really about the content, but the sizing of the iframe on mobile Safari. – user1647525 May 12 '16 at 22:21
  • is it also ignoring max-width:100% !important ? – yezzz May 12 '16 at 22:38
  • Thanks for the contributions, but it had nothing to do with responsiveness. It had to do with a min-width default setting in the frontend framework that was used for the content within the iframe. – user1647525 May 13 '16 at 05:00

2 Answers2

0

In the past, I have seen many problems with mobile Safari, and this one seems to fit in to the problems of mobile Safari. Here is my recommendation: research AJAX, and get the code of a webpage, and copy and paste it into a div. http://www.w3schools.com/ajax/default.asp

pepperjack
  • 673
  • 6
  • 20
0

Thanks to those who contributed, but I solved my own problem. The problem was that the content within my iframe was using the Semantic-UI framework which had a min-width of 320px set on the body. I simply overrode it by setting min-width to 0 on body.

user1647525
  • 311
  • 3
  • 14