For clarification, I've included an approximation of what I meant by
dynamic iframe.
The idea is to create the iframe using src='javascript:;' to keep it
in the same domain as the parent iframe, use document.write() to
initialize a full HTML document inside of it, and finally, add scripts
dynamically inside of its body. This method works across every
browser (including android and iPhone webkit). I've not done any
performance tests to see what sort of hit you take referencing symbols
across window boundaries but it seems reasonable to assume it would be
the same as today's IFrameLinker.
Note that IE also has the "new ActiveXObject('htmldocument')" that
works much like a headless iframe but doesn't have a navigation click.
var iframe = document.createElement('iframe');
iframe.src = 'javascript:;';
iframe.style.cssText = 'position:absolute; top:-1000px; left: -1000px;';
document.body.appendChild(iframe);
var iframeDoc = iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write('<html><body></body></html>');
iframeDoc.close();
var script = iframeDoc.createElement('script');
script.type = 'text/javascript';
script.src = 'http://myoffdomaincdn.example.com/' + scriptName;
iframeDoc.body.appendChild(script);
Additional scripts would be created in the same way as the primary
script.
On 1-Dec-09, at 9:59 AM, Joel Webber wrote:
> To be clear, I don't know of any cases where people *can't* use
> iframes. There are some cases where teams have chosen to use
> <script> tags for an assumed performance benefit, but I don't know
> of anyone ever having measured it. Most of the time people use
> <script> tags for cross-site or late-loading behavior. If we could
> make iframes work for these cases, and show that there's no
> performance benefit to <script> tags, it may be less of an issue.
>
> The iPhone only has problems rendering iframes (it essentially drops
> their content into the outer page as though it were inline), but
> that's about it.
>
> On Tue, Dec 1, 2009 at 11:44 AM, Lex Spoon <sp...@google.com> wrote:
> Thanks for the test code and data, Matt! It sounds like enough
> browsers are covered that error reporting is no longer a major decider
> between XHR vs. script tags.
>
> Regarding iframes, be aware that some GWT users can't use them. I
> don't know all the reasons why, but one example reason is that iframes
> don't work reasonably on iPhones. So, we need to support non-iframe
> linkers for at least some use cases.
>
>
> Lex
>
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors