GWT/GXT application with a popup and iFrame, under Internet Explorer with Adobe reader, PDF does not hide

StackOverflow https://stackoverflow.com/questions/17606652

سؤال

This is a strange issue that is probably mostly related to Internet Explorer and the Adobe PDF reader. On other browsers and PDF readers, I don't get this issue. E.g. with Chrome and their built-in PDF reader, I don't get this issue.

I am opening a PDF document in the 'Frame' object and when I close the Frame, the PDF does not go away. Essentially the PDF is still there until I close the browser.

Has anyone noticed? Are there any tricks to ensure that the PDF is properly closed?

Here is a screenshot, notice how the PDF is still kind of floating out there.

Use the code below, is it possible to easily convert that logic to using the HTML 'object' tag ?

Here is most of the code, essentially bring up a popup in a frame:

import com.google.gwt.user.client.ui.Frame;

        final Frame centerDocumentFrame = new Frame();
        final SafeUri uri = new SafeUri() {
                    @Override
                    public String asString() {
                        return "/path/PATH_TO_PDF";
                    }
        };
        centerDocumentFrame.setUrl(uri);

        final Window gridPopup = new Window();
        gridPopup.setWidget(centerDocumentFrame);
        gridPopup.setMaximizable(true);
        gridPopup.setClosable(true);
        gridPopup.setResizable(true);

<iframe class="gwt-Frame GL2YXWTBNL GL2YXWTBLFC" 
src="PDF" style="left: 360px; top: 0px; width: 431px; height: 358px;"/>

On close, the PDF document is sitting there.

Note: this is probably an Internet Explorer and Adobe Reader issue. Apparently with this type of dynamic iFrame and populating it with a PDF, and then closing, Adobe isn't releasing that screen properly. Is there some kind of work around? We were also trying to avoid using the object tag in favor of the iframe

Environment:

Gxt Version : 3.0.1
GWT: 2.5.1
Windows 7
Internet Explorer 9 (no quirks mode)
Tomcat 7
Adobe Reader Version 10.10

More details here:

http://www.sencha.com/forum/showthread.php?267784-Issue-with-popup-Window-on-Internet-Explorer-and-iFrame-and-Adobe-Reader-PDF-document

Related:

http://social.msdn.microsoft.com/Forums/ie/en-US/8ff26bbd-9471-4137-ac6a-ff34ee02ab74/iframepdf-not-hiding-in-ie10

هل كانت مفيدة؟

المحلول

Could you try this : (I extend the Frame to be able to remove it from the DOM on the Event.ONLOAD). I use it to mimic the "download file" for example. It could be a workaround to this IE9 bug.

public class HiddenFrame extends Frame {

    public HiddenFrame(String url) {
        super();
        //setSize("0px", "0px");
        //setVisible(false);
        sinkEvents(Event.ONLOAD);
        RootPanel.get().add(this);
        setUrl(url);
    }

    public void onBrowserEvent(Event event) {
        if (DOM.eventGetType(event) == Event.ONLOAD) {
            unsinkEvents(Event.ONLOAD);
            DOM.eventCancelBubble(event, true);
            RootPanel.get().remove(this);
        } else {
            super.onBrowserEvent(event);
        }
    }

}

نصائح أخرى

I've experienced the exact same issue. The only fix for me was to remove everything from the RootLayoutPanel and add it again.

RootLayoutPanel.get().clear();
RootLayoutPanel.get().add(new MyPanel());
RootLayoutPanel.get().forceLayout();

If you have a panel that, in position and size, wraps the pdf entirely, you can try setting that to invisible and then visible. I'm not sure if this will help, however

EDIT

Resizing the component that contains the iFrame may work too, it does for me.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top