2024-01-09, 14:33:46
Maddire,
Figured to have another look at this and saw my mistake...
The code:
does not just return a html element, instead it returns a HTMLCollection array... an array with 1 element.
So my mistake was to try and send "click" from the array instead of the html element.
Just tested it and this code works fine:
Obviously it could use some error checking, but the principle works fine.
It triggers a download just like you are after.
--
Wil
Figured to have another look at this and saw my mistake...
The code:
Code:
var downloadButton;
downloadButton = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
So my mistake was to try and send "click" from the array instead of the html element.
Just tested it and this code works fine:
Code:
var downloadButton;
downloadButton = document.getElementsByClassName("mega-button positive js-default-download js-standard-download");
downloadButton[0].click();
Obviously it could use some error checking, but the principle works fine.
It triggers a download just like you are after.
--
Wil