Our webpage sometimes sends a file to download via the javascript window.open(...), e.g.:
window.open('https://oursite.com/Downloads/something.xls');
I have a downloadhandler added to the cefclient and if I use the php command header("Location: 'https://oursite.com/Downloads/something.xls'''); instead of a javascript window.open(...) the download works perfectly.
The window.open method works on a desktop chrome browser. But if I use the window.open method from our integrated java-cef browser it currently only opens a blank popup window.
To check what's happening I added a LifSpanHandler:
- Code: Select all
client_.addLifeSpanHandler(new CefLifeSpanHandlerAdapter() {
@Override
public boolean onBeforePopup(CefBrowser br, CefFrame cf, String url, String target_frame_name) {
System.out.println("On Before popup: url="+url+", target_frame_name="+target_frame_name);
System.out.println("Client: "+br.getClient()); //this shows the same String as client_.toString();
return false;
}
});
And it shows that url is https://oursite.com/Downloads/something.xls as it should be, so it is trying to open a popup for the file.
I want the download handler to work in the window.open(...) situation too, what would you recommend?
Thank you!