<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Povert &#187; resize</title>
	<atom:link href="http://www.povert.com/tag/resize/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.povert.com</link>
	<description>It&#039;s Pronounced &#34;Pah-vert.&#34;  You povert.</description>
	<lastBuildDate>Tue, 18 Oct 2011 15:33:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dynamic Resizing of Cross-Domain Iframes</title>
		<link>http://www.povert.com/2008/05/19/dynamic-resizing-of-cross-domain-iframes/</link>
		<comments>http://www.povert.com/2008/05/19/dynamic-resizing-of-cross-domain-iframes/#comments</comments>
		<pubDate>Mon, 19 May 2008 21:31:06 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[WWW]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[resize]]></category>

		<guid isPermaLink="false">http://www.povert.com/?p=770</guid>
		<description><![CDATA[If you&#8217;ve ever wanted to have an iframe resize itself based on its (cross-domain) contents, you may have run into some problems. I had to tackle this somewhat recently. The solution is silly, but it works. The problem is that an iframe can&#8217;t communicate with its parent if they&#8217;re on different domains. For example, let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wanted to have an iframe resize itself based on its (cross-domain) contents, you may have run into some problems.</p>
<p>I had to tackle this somewhat recently.  The solution is silly, but it works.</p>
<p>The problem is that an iframe can&#8217;t communicate with its parent if they&#8217;re on different domains.  For example, let&#8217;s say I put an iframe here on povert.com.  The iframe could be pointing to, say, flappingcrane.com.  Povert.com can&#8217;t access any useful information about the iframe, and vise-versa.</p>
<p>The solution is to have the iframed content (in this case flappingcrane.com) iframe something else from the original domain.  So you could set up a file on povert.com called yaygo.html.  Then flappingcrane.com iframes that, <strong>with a GET query</strong>.  That GET query should contain any information you want to communicate to the parent (povert.com).  Since yaygo.html is on povert.com, it can refer to povert.com with <strong>parent</strong> (though, since they&#8217;re different domains, it can&#8217;t do anything useful) and to flappingcrane.com with <strong>parent.parent</strong>.  Because they&#8217;re on the same domain (even with the intermediate flappingcrane.com iframe), it can do something useful &#8212; like pass values from the GET query to a function:</p>
<p><code style="font-size: 85%;"><br />
parent.parent.setFunProps(iframeid, width, height, tacoflavor);<br />
</code></p>
<p>setFunProps() can then take those values and do what it wants with it (resize the iframe, whatever).</p>
<p>Another tidbit.  If you give a <strong>name</strong> attribute to an iframe, that iframe&#8217;s contents can access the name with <strong>window.name</strong>.  You can&#8217;t access <strong>window.id</strong> though, unfortunately.  Either are handy for identifying to the parent document what iframe is requesting a resize, though there are other crappier ways to do it (passing its own url to match against iframe src, for example).</p>
<p><strong>UPDATE</strong>: As I mention in <a href="#comment-11817">my comment below</a>, you can see an example of this at <a href="http://povert.com/fun/iframe/">http://povert.com/fun/iframe/</a>.</p>
<p><del datetime="2011-10-18T15:14:45+00:00"><strong>UPDATE (Oct 28, 2009)</strong>: Looks like it doesn&#8217;t work in any version of IE now.  It&#8217;s possible that Microsoft saw this as a security hole and fixed it.</del></p>
<p><strong>UPDATE (Oct 18, 2011)</strong>: <a href="#comment-33367">jajasilver pointed out</a> that the examples didn&#8217;t set a DOCTYPE (oops — thanks!). This has been corrected and the examples work again. Wow, I hadn&#8217;t looked at this for years.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.povert.com/2008/05/19/dynamic-resizing-of-cross-domain-iframes/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.povert.com @ 2012-02-07 03:42:05 -->
