Revision: 6891 Author: [email protected] Date: Fri Nov 13 09:04:35 2009 Log: Makes the "missing plugin" iframe take up the entire window for a reasonably nice look that works across browsers.
Change by: bruce Review by: jat http://code.google.com/p/google-web-toolkit/source/detail?r=6891 Modified: /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html ======================================= --- /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html Tue Nov 10 14:13:03 2009 +++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html Fri Nov 13 09:04:35 2009 @@ -29,12 +29,32 @@ } function loadIframe(url) { - var iframe = $doc.createElement('iframe'); - iframe.src = url; - iframe.style.width = "100%"; - iframe.style.height = "100%"; - iframe.style.borderWidth = "0px"; - $doc.body.insertBefore(iframe, $doc.body.firstChild); + var topDoc = window.top.document; + + // create an iframe + var iframeDiv = topDoc.createElement("div"); + iframeDiv.innerHTML = "<iframe scrolling=no frameborder=0 src='" + url + "'>"; + var iframe = iframeDiv.firstChild; + + // mess with the iframe style a little + var iframeStyle = iframe.style; + iframeStyle.position = "absolute"; + iframeStyle.borderWidth = "0"; + iframeStyle.left = "0"; + iframeStyle.top = "0"; + iframeStyle.width = "100%"; + iframeStyle.backgroundColor = "#ffffff"; + iframeStyle.zIndex = "1"; + iframeStyle.height = "100%"; + + // update the top window's document's body's style + var hostBodyStyle = window.top.document.body.style; + hostBodyStyle.margin = "0"; + hostBodyStyle.height = iframeStyle.height; + hostBodyStyle.overflow = "hidden"; + + // insert the iframe + topDoc.body.insertBefore(iframe, topDoc.body.firstChild); } if ($legacyHosted) { -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
