The following code will download htmlTest.html in Chrome, but when run in Firefox will download htmlTest.html.pdf Why does firefox add .pdf? I want to download .html as specified.
<html>
<head> </head>
<body>
<button onclick="download()">Download html file</button>
<script type="text/javascript">
function download() {
var element = document.createElement("a");
var inshtml = `hello world`;
element.setAttribute(
"href",
"data:text/plain;charset=utf-8," + encodeURIComponent(inshtml)
);
element.setAttribute("download", "htmlTest.html");
element.style.display = "none";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
</script>
</body>
</html>