How to prevent download prompts from appearing?


Is there a way to disable the “Save as” prompts globally? I don’t want my electron app to have these dialogs since it pauses a timer script whenever it shows up. My app loads other users’ websites in a webview and since I do not have control over their content, the guests’ content can force download prompts which is undesirable (same goes for dialogs).

I think “will-download” has something to do with disabling it but I don’t know exactly how to go about doing this. Any help would be highly appreciated, thanks!


There is an option to save the content automatically without even asking about the location to user.

Do you want to disable the pop up/dialogues check this thread

Please explain clearly if your question is different


Hi @myfrndjk1, thanks for your help. I actually don’t want them to download any items with Electron app, so completely disable the “save as” dialog. I think the “save as” dialog is unrelated to the alert/confirm/prompt dialogs because when I added “alert = confirm = prompt = function () {};”, the alert/confirm/prompt will not occur but “save as” dialog will still occur.


Below code may help you. Shamelessly stolen from

// main.js
let webviewSession = session.fromPartition(partitionName);
webviewSession.on('will-download', function(e, item, webContents) {
    if (item.getMimeType() === "application/pdf") {
        // logic


Thanks! It is working now :slight_smile: