Solved Download dialog not shown on some websites
-
Vivaldi 6.6: no download dialog with JavaScript
Since the update to 6.6.3271.45 (Stable channel) (64-bit) my Javascript executes downloads without the download dialog, which normally popup ups below the address bar. Previously the download was triggered and the download dialog appeared, now nothing happens except for a short loading indicator on the mouse cursor and the download in the background. Since the problem reproducibly occurs directly after the Vivaldi 6.6 update (testet in VM and new Vivaldi install) and it worked in 6.5, the reason must be a change in Vivaldi's behavior. This could be a security issue.
In private mode, at least the explorer opens to select a target for the download, but also no download dialog.
Normal links to files still have a download dialog.
JS to reproduce with Tampermonkey:
const picture = document.querySelector("img"); const pictureUrl = picture.src; GM.xmlHttpRequest({ method: "GET", url: pictureUrl, headers: { referer: pictureUrl, origin: pictureUrl }, responseType: "blob", onload: function (resp) { const pictureBlob = resp.response; picture.addEventListener("click", function () { const blobUrl = window.URL.createObjectURL(pictureBlob); const downloadLink = document.createElement("a"); downloadLink.href = blobUrl; downloadLink.setAttribute("download", newFilename); downloadLink.click(); window.URL.revokeObjectURL(blobUrl); }); }, });
--
ModEdit: Title
-
The minor update that was just released included this fix: [Downloads] No download dialog shown (VB-104397). Could you update and see if it fixes your issue?
-
@enompado Please report issue to Vivaldi bug tracker. Once that is done, share the bug number (beginning with VB-) you got by bug report mail. Thanks for helping us making Vivaldi better.
-
@enompado
Hi, check if automatic download is disable in site settings, you can open it from the padlock icon in the address bar.Cheers, mib
-
I have tested that too. But this has no influence.
-
VB-104397
-
@enompado How does one "reproduce" this "with Tampermonkey"?
Please make a step-by-step guide or make a basic test case for reproduction and link it.
-
I'm not sure if it's a good idea to publicly explain to everyone how to reproduce the problem since, as I said, it may be a security issue.
- create a Tampermonkey script for a page with the script and for this case with the permission:
// @grant GM.xmlHttpRequest - set const picture to a querySelector of an image of the page
- load the page and then click on the image
- create a Tampermonkey script for a page with the script and for this case with the permission:
-
@enompado Can't make that work, I'm no expert on userscripts.
Please provide the full userscript and a url to test with.
I tried the following:
// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 2024-02-29 // @description try to take over the world! // @author You // @match https://pathduck.github.io/test/cache/ // @icon https://icons.duckduckgo.com/ip2/github.io.ico // @grant GM.xmlHttpRequest // ==/UserScript== (function() { 'use strict'; const picture = document.querySelector("img"); const pictureUrl = picture.src; GM.xmlHttpRequest({ method: "GET", url: pictureUrl, headers: { referer: pictureUrl, origin: pictureUrl }, responseType: "blob", onload: function (resp) { const pictureBlob = resp.response; picture.addEventListener("click", function () { const blobUrl = window.URL.createObjectURL(pictureBlob); const downloadLink = document.createElement("a"); downloadLink.href = blobUrl; downloadLink.setAttribute("download", newFilename); downloadLink.click(); window.URL.revokeObjectURL(blobUrl); }); }, }); })();
Error:
Uncaught ReferenceError: newFilename is not defined at HTMLImageElement.<anonymous> (userscript.html?name=New-Userscript.user.js&id=11dce359-6111-4f5c-af58-2a430f45976e:28:51)
-
// ==UserScript== // @name Vivaldi VB-104397 // @match https://vivaldi.com/* // @grant GM.xmlHttpRequest // ==/UserScript== const picture = document.querySelector("#main div.section div.spaced img"); const pictureUrl = picture.src; GM.xmlHttpRequest({ method: "GET", url: pictureUrl, headers: { referer: pictureUrl, origin: pictureUrl }, responseType: "blob", onload: function (resp) { const pictureBlob = resp.response; picture.addEventListener("click", function () { const blobUrl = window.URL.createObjectURL(pictureBlob); const downloadLink = document.createElement("a"); downloadLink.href = blobUrl; downloadLink.setAttribute("download", "Picture"); downloadLink.click(); window.URL.revokeObjectURL(blobUrl); }); }, });
For me its this picture:
-
I have the same behavior on web.whatsapp.com with the download button for images when you open them (large view). Then there is no browser download dialog there either. So its definitely an issue with javascript handling.
-
@enompado OK that seems to work. Yes, I can confirm it saves the image directly instead of asking.
It does the same in Chrome 122 and Chromium 122.
I still don't see where the bug is. You've made a userscript that does download stuff. What relation does this have to being a bug?
What's the use case for this on an actual site where this breaks site functionality?
Just because something changed in the browser core does not make it a bug.
As a developer, it's your task to figure out what changed and how to fix your code to take that into account. -
@enompado Bug is now investigated by a Vivaldi dev.
-
OK I found some better examples than a user script:
https://gieves-edit.netlify.app
https://pqina.nl/blog/how-to-prompt-the-user-to-download-a-file-instead-of-navigating-to-it/That does prompt in 6.5.
Of course, the other browsers have users who are used to downloads just starting without a prompt so any change in JS behaviour wouldn't matter to them at all. -
@Pathduck said in Vivaldi 6.6: no download dialog with JavaScript:
I still don't see where the bug is. You've made a userscript that does download stuff. What relation does this have to being a bug?
I'm a little surprised that I have to clarify this, but the flaw is that it is now possible to write to the file system without the user's knowledge and without the user being able to prevent it.
And purely for practical reasons, it is now no longer possible to say where I want to save the download.
-
but the flaw is that it is now possible to write to the file system without the user's knowledge and without the user being able to prevent it
The site still have to be interacted with to trigger the download. The browser will not allow a click event without actual user interacting with the site. And then there's no difference from earlier behaviour - in most browsers a download will simply start without a question anyway. Just Vivaldi is different and actually asks (or used to ask as it were...)
OK we will leave it to a developer to figure out if it's a bug or not. The report is already done.
Please update your bug report by replying to the email you got when reporting, and update without your working use case email and the test cases I linked earlier. Basing a bug report on a user script is not the best reproduction steps, you need to show an actual test case.
-
Hi,
I was used to chose download location for every download separately. Since the update, it all goes to the default download folder.
Also have not found the setting to let chose location for each download.
Thanks for help! -
@Tapbeat
Hi, I use this all day, check the setting "Save Files to Default ....
It has to be unchecked.
If this not work an extension can cause this after the update, try it in a private window.Cheers, mib
-
ok thank you!
It must be an extension then... -
I have no extension installed and that setting does not work, i.e. now Vivaldi always save to the default location without asking anything. In fact I found that option already unchecked when I searched for this bug and then I even toggled it just in case – no difference.
??
Edit: it seems to be related this issue.
-
Vivaldi dev is working on a fix now. Stay tuned.