I have a ExtJs application. When user needs to view PDF report generated on the server side I open a new link using window.open()
function. I pass URL for service that provides PDF file stored on the web server.
This function is called from two different places: user can scroll list of reports and click toolbar button on one of them and see the report, or user can execute report, wait till it generated and then application will automatically present it. The only difference between two scenarios - second one is async and the last step where report is open is called from callback functions.
But these two cases behave differently. First one - will open new tab in Chrome, and in Safari and this will not be considered a popup
window. In second case - it will be opened in new window (in the same browsers of course - so the configuration is exactly same).
I'm stuck to figure out why the behavior is different.
Any idea?
Update: To clarify - both are JS calls. one is something like:
buttonClick: function() {
window.open('myreporturl');
}
other is a bit more complicated but at the end:
runReport: function() {
store.on('load', function {
window.open('myreporturl');
});
store.load();
}
Update2: I was able to figure out what's going on. If JS opens external window immediately after user initiated event (user click basically) - it gets treated by browser as new tab. If I put a 5 sec delay for the same button click event handler - it gets treated as new window.
Does it make sense to anybody?