Generating HTML file using javascript and using correct MIME types like “text/html”

                var text = "this is the content";                    
                var name = "myfilename.txt";
                var type = "text/html";
                var a = document.getElementById("a");
                a.style.display = "block";
                var file = new Blob([text], {type: type});
                a.href = URL.createObjectURL(file);
                a.download = name;

Leave a Comment