08-18-2019, 09:34 PM
SendFile works in all browsers. It is probably being blocked by a popup blocker, no?
SendFile() during Async calls is not good idea, IMO.
First: it doesn't make any difference in terms of page loading times, flicker, etc. Actually the sync event is more straightforward than the Async event.
Second: the browser "understands" a OnClick event which opens a popup window as a direct action of the user, so almost everything is allowed (including opening a popup window).
On the other hand, an async event is not a direct user action: the Async event generates a XMLHttpRequest (Ajax) to the server, which responds with JavaScript which then tries to open a popup window. This is - in general - forbidden by browsers, by default, which causes it to fail.
So, in short:
- OnClick = Sync = direct user action -> browser allows it to open popups
- OnAsyncClic = Async/Ajax = user action triggers JavaScript code -> browser doesn't allow it to open popups
SendFile() during Async calls is not good idea, IMO.
First: it doesn't make any difference in terms of page loading times, flicker, etc. Actually the sync event is more straightforward than the Async event.
Second: the browser "understands" a OnClick event which opens a popup window as a direct action of the user, so almost everything is allowed (including opening a popup window).
On the other hand, an async event is not a direct user action: the Async event generates a XMLHttpRequest (Ajax) to the server, which responds with JavaScript which then tries to open a popup window. This is - in general - forbidden by browsers, by default, which causes it to fail.
So, in short:
- OnClick = Sync = direct user action -> browser allows it to open popups
- OnAsyncClic = Async/Ajax = user action triggers JavaScript code -> browser doesn't allow it to open popups