Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5 Safari and the IFRAME element

Where can I find documentation about the new behavior of the IFRAME element in iOS 5 Safari? Empirical evidence suggests that IFRAMEs now will expand to fit the content, expanding the containing document to do so, thereby often breaking code that works fine in iOS4.3 (and desktop browsers).

Is there any way to control this new behavior?

like image 459
Oskar Austegard Avatar asked Oct 14 '11 15:10

Oskar Austegard


1 Answers

I couldn't find any official documentation that lists the differences of the <iframe> tag in iOS5, but I found these links which do explain a little bit about the new <iframe> tag/changes in iOS5 safari.

New Mobile Safari stuff in iOS5

iOS SDK Release Notes for iOS 5.0

Handling Events, Safari Web Content Guide

You mentioned that the <iframe> tag now stretches to the width of the content inside it. Would you want it to be a set width?

You could either...

  1. Try styling the iframe in css to the width you want it (I'm sure you've tried this)
  2. Set a width to the body tag so that the iframe doesn't stretch outside of it (not sure if this works)
  3. Put a <div> around the content being retrieved by the iframe that has a set width

Edit: I just read the comment saying to style the iframe directly, but you mentioned it doesn't work. I'd try styling the container div instead, if that's an option.

like image 64
Charlie Avatar answered Sep 19 '22 17:09

Charlie