JXBROWSER : disabling pdf plugin in a popup doesn't allowed to download a pdf -
i'm using jxbrowser 4.9 on windows 7, when link has target="_blank" , point pdf,
a new popup coming pdf plugin,
as want download pdf, disabled pdf plugin in popup, via
pluginmanager pluginmanager = browser.getpluginmanager(); pluginmanager.setpluginfilter(new pluginfilter() { @override public boolean ispluginallowed(plugininfo plugininfo) { return false; } });
the popup shows black screen "couldn't load plugin" not offers me download pdf.
if change link suppress target="_blank", , disabled pdf plugin, pdf can downloaded.
is there special thing pdf downloaded when target="_blank"?
thanks !
here 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 plugins return false; } }); browser.setpopuphandler(new popuphandler() { public popupcontainer handlepopup(popupparams params) { return new popupcontainer() { public void insertbrowser(final browser browser, rectangle initialbounds) { initialbounds.setbounds(100, 100, 500, 400); jcomponent component = browser.getview().getcomponent(); component.setpreferredsize(initialbounds.getsize()); final jframe frame = new jframe("popup"); frame.setdefaultcloseoperation(windowconstants.dispose_on_close); frame.add(component, borderlayout.center); frame.pack(); frame.setlocation(initialbounds.getlocation()); frame.setvisible(true); frame.addwindowlistener(new windowadapter() { public void windowclosing(windowevent e) { browser.dispose(); } }); pluginmanager pluginmanager = browser.getpluginmanager(); pluginmanager.setpluginfilter(new pluginfilter() { @override public boolean ispluginallowed(plugininfo plugininfo) { return false; } }); } }; } }); browser.loadurl("http://localhost/test.html"); }
}
and test.html page :
<html> <head></head> <body> <h1>pdf</h1> <a href="javascript.pdf" target="_blank">download/open pdf file new page</a> <br><br> <a href="javascript.pdf">download/open pdf file same page</a> </body> </html>
use pdf.
jxbrowser 4.9 no longer supported. in jxbrowser 6.1 issue isn't reproducible, recommend try 6.1.
Comments
Post a Comment