I want to download text inside placeholder as text file in my chrome extension options page.it is working well in w3schools compiler but not working in chrome extension here is my code:
<script>
function downloadFile() {
let text = document.getElementById("blocked-list").value;
var blob = new Blob([text], {type: "text/plain"});
const url = URL.createObjectURL(blob);
var downloadLink = document.createElement("a");
downloadLink.href = url;
downloadLink.download = "export.txt";
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
URL.revokeObjectURL(url);
}
</script>