I have a button which opens a new tab with a generated pdf-file. However, after I click on the button, I want to navigate to another page.
That means, after clicki
As BalusC said, Refresh/navigate current page
and opening downloading file
are two different responses, there must be two resquests. I encountered a similar problem. I solved it with jsf ajax successfully.
Here's part of my code:
XHTML:
Javascript:
function checkCallBack(data) {
var ajaxStatus = data.status;
switch (ajaxStatus) {
case "begin":
break;
case "complete":
break;
case "success":
document.getElementById('download-form:download-button2').click();
break;
}
}
download-button
renders a message area on page and download-button2
triggers a download method. they are two different requests. When the first request completed, the second request will be triggered.