3

Hello I'm developing a GWT application that has iframes inside. Im testing in localhost with Tomcat 6 and IE8.

I changed localhost domain (in hosts file: C:\WINDOWS\system32\drivers\etc\hosts) to be something1.something2.com, so now I have in my hosts file:

127.0.0.1 something1.something2.com

So, I run my Tomcat6 in IE8 something1.something2.com:8080/mygwtapp and mygwtapp runs OK. The problem is when I change document.domain into file.html of GWT app. In gui.html I have this:

<html>
    <head>
        <title>...</title>
        <style>...</style>
        <script language="javascript">
            document.write(document.domain);    
            document.domain = "something2.com"
            document.write(document.domain);
        </script>
        <meta name='gwt:module' content='scripts/com.something2.gui=com.something2.gui'>
    </head>
    <body>
        <script language="javascript" src="scripts/gwt.js"></script>
        <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
        <table align=center>
            <tr>
                <td id="slot1"></td>
                <td id="slot2"></td>
            </tr>
        </table>

    </body>
</html>

So, I run my app again with this gui.html and I get:

something1.something2.comsomething2.com

(just like that at the top) That is expected, but then all that I get is a blank page. So I see the line above and nothing else, just blank page.

I'll show you the gui.gwt.html:

<module>
    <!-- Specify the app entry point class.-->
    <entry-point class='com.something2.client.GUI'/>

    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name="com.google.gwt.http.HTTP"/>
    <inherits name="com.google.gwt.xml.XML" />
    <servlet path='...' class='...l'/> // I have several servlets here, but I don't think they are causing issues here.
</module>

Something to add: Im working with iframes that are created from inside GWT java code, my purpose to change domain is to be able to communiate with iframes that has already defined the document.domain in its head of html page to be something2.com (same as me or at least same as what I 'm trying to do)

So, I don't know what I am doing wrong here.

royhowie
  • 11,075
  • 14
  • 50
  • 67
Joaco
  • 31
  • 2

1 Answers1

2

This is because GWT loads itself within an iframe. You can add that line to your gwt.xml file to load without iframes:

<add-linker name="xs" />

You'll lose DevMode support however. There's a xsiframe linker (which loads code using <script> tags and injects it into an iframe to isolate it from the page) that has DevMode support, but I don't know if it'd work with your document.domain setup.

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164