Stéphane G. February 2016

JXBROWSER : disabling pdf plugin in a popup doesn't allowed to download a pdf

i'm using jxbrowser 4.9 on windows 7, when a link has a target="_blank" and point to a pdf,

a new popup is coming with the pdf plugin,

as i want to download this pdf, i disabled the pdf plugin in that popup, via

PluginManager pluginManager = browser.getPluginManager();
pluginManager.setPluginFilter(new PluginFilter() {
  @Override
  public boolean isPluginAllowed(PluginInfo pluginInfo) {
    return false;
  }
});

the popup shows a black screen with "couldn't load plugin" but not offers me to download the pdf.

If i change the link to suppress the target="_blank", and disabled the pdf plugin, the pdf can be downloaded.

Is there a special thing to do to get a pdf downloaded when target="_blank"?

thanks for your help !

Here is my simple class : public class TestPopupPDF {

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            initAndDisplayUI();
        }
    });
}

private static void initAndDisplayUI() {
    Browser browser = BrowserFactory.create();

    JFrame frame = new JFrame("JxBrowser - Popup PDF test");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.add(browser.getView().getComponent(), BorderLayout.CENTER);
    frame.setSize(500, 400);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    PluginManager pluginManager = browser.getPluginManager();

    pluginManager.setPluginFilter(new PluginFilter() {
        @Override
        public boolean isPluginAllowed(PluginInfo pluginInfo) {
            //disable all plugins
            return false;
        }
    });

    browser.setPopupHandler(new PopupHandler() {
        public PopupContainer handlePopup(PopupParams params) {
            return new PopupContainer() {
                public void insertBrowser(final Browser browser,
                        R        

Answers


Vladimir February 2016

JxBrowser 4.9 is no longer supported. In JxBrowser 6.1 this issue isn't reproducible, so I recommend that you try 6.1.

Post Status

Asked in February 2016
Viewed 3,662 times
Voted 6
Answered 1 times

Search




Leave an answer