Issue Reloading Frame

871 views
Skip to first unread message

Thomas Mancini

unread,
Jun 14, 2012, 10:17:26 AM6/14/12
to google-we...@googlegroups.com
All,

I am currently working on a GWT project where I am displaying an HTML file within an iframe in my application.  This HTML file is actually being written to as it is getting displayed, and I am hoping to be able to reload the frame so that the changes made to the HTML file are reflected on screen.  I am able to do this two different ways that both work when running in development mode, however neither seem to work when the project is deployed.

The first method I tried was setting the frame's URL to itself: frame.setUrl(frame.getUrl());

The second method I tried using JSNI:

public native void refresh() /*-{
    if($doc.getElementById('__reportFrame') != null) {
          $doc.getElementById('__reportFrame').src =
                $doc.getElementById('__reportFrame').src;
    }
  }-*/;

When deployed, the frame gets displayed in a Window, and when the file is finished being written to, a call to either of these refresh methods is made, and the frame refreshes to contain the finished HTML file.  When I am deployed, the call to the refresh does not reload the contents of the frame, however if I bring up the frame's context menu (in Firefox), then go into This Frame, and click reload, it successfully reloads the frame to contain the finished HTML file.  I have tested this on multiple versions of Firefox without any luck.

Does anyone have any suggestions?  Why would the behavior be different from one mode to the other?

Thanks.

Paul Stockley

unread,
Jun 14, 2012, 10:51:09 AM6/14/12
to google-we...@googlegroups.com
You can use some JSNI to do this. Create a method such as 

protected native void reloadIFrame(Element iframeEl) /*-{
iframeEl.contentWindow.location.reload(true);
}-*/;

     Then call it with your iFrame element

Thomas Mancini

unread,
Jun 14, 2012, 5:09:01 PM6/14/12
to google-we...@googlegroups.com
Thanks for the reply, although this also seems to work fine in Development mode, but not when Deployed and running via Tomcat.
Reply all
Reply to author
Forward
0 new messages