Dynamic hyperlink issue with Firefox | Dynamic element issue with different browsers

Published: 31 July 2019
on channel: Yogesh Kumbhat
14
0

Firefox doesn't allow any action to be performed on any element until its not there in DOM. Here is a code about adding the dynamic hyperlink to the DOM and make it work on all the browser.

$(document).ready(function(){
$("#download_button").click(function()
{
var req = new XMLHttpRequest();
req.open("GET", "/41138.docx", true);
req.responseType = "blob";
req.onload = function (event) {
alert("hi");
var blob = req.response;
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download="sample.docx";
$("body").append(link);
link.click();
};
req.send();
});
});


On this page of the site you can watch the video online Dynamic hyperlink issue with Firefox | Dynamic element issue with different browsers with a duration of hours minute second in good quality, which was uploaded by the user Yogesh Kumbhat 31 July 2019, share the link with friends and acquaintances, this video has already been watched 14 times on youtube and it was liked by 0 viewers. Enjoy your viewing!