You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a window's webContents.downloadURL(URL) method if the specified URL returns a 404 the will-download event on webContents.session does not fire and instead a dialog pops up asking the user to save an html file (the contents of the 404 page).
Is this expected behavior and is there any event I can listen to or some other way to get around this? I'd like to handle the error differently if possible.
Thanks
The text was updated successfully, but these errors were encountered:
I have same issue with electron version 11.1.0.
I want to know how to prevent opening save dialog when the server returns 404 not found.
But I don't know how to check the response status code...
mainWindow.webContents.session.on('will-download',(event,item,webContents)=>{if(/* check if response status code != 200) */){event.preventDefault();}});
When calling a window's
webContents.downloadURL(URL)
method if the specified URL returns a 404 thewill-download
event onwebContents.session
does not fire and instead a dialog pops up asking the user to save an html file (the contents of the 404 page).Is this expected behavior and is there any event I can listen to or some other way to get around this? I'd like to handle the error differently if possible.
Thanks
The text was updated successfully, but these errors were encountered: