Skip to content

Conversation

@sarahgoldman
Copy link

Added support for multiple iframes on one page by passing the href as well as the height to the parent window in postMessage, and then only resizing the iframe with the matching src attribute. I have tested it with cross-domain frames in IE8+, Chrome, Safari, and Firefox.

It seems the existing fallback method was setting the hash in the frame window and then checking it in the parent window. It is now setting it in the frame and checking each iframe for its content window hash. Still doesn't work across domains, but I have added a catch so it won't error. This is still only applied to IE7 and other browsers where postMessage is not supported.

Lastly, I cleaned up the files to pass as much of jslint as possible.

Sarah Goldman added 2 commits September 25, 2013 15:41
… well as the height to the parent and then only resizing the iframe with the matching src attribute; Cleaned up the fallback code to both set and check the height hash on the frame. This is still blocked by cross-domain scripting restrictions, however it is not breaking the page in IE7
@ghost ghost assigned jaredbiehler Sep 26, 2013
@inadarei
Copy link
Contributor

Thanks a lot for the PR, Sarah. This sounds great. We will try to review and test as soon as possible.

@sarahgoldman
Copy link
Author

I noticed one shortcoming with my method: when you navigate to other pages within the iframe it stops resizing because the location.href of the frame will no longer match an iframe src on the top page. But ideally it should continue to be responsive as long as the page navigated to also has responsiveIframe called on it.

As is, it's not broken, it's just not responsive after leaving the first page. I'm working on a fix now.

…href to iframe src. This will allow navigation to new pages within a responsive frame to continue to resize as long as new pages also call allow embedding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants