This script works fine to save the current url to text file:
<script type="text/javascript">
setTimeout("create(window.location.href, 'file.html', 'text/plain')");
function create(text, name, type) {
var dlbtn = document.getElementById("save");
var file = new Blob([text], {type: type});
dlbtn.href = URL.createObjectURL(file);
dlbtn.download = name;
}
</script>
<a href="javascript:void(0)" id="save"><button>SAVE</button></a>
But I need the finished file to look like below, how do I add the extra code to the file?
<script type="text/javascript">
window.location.href = "CURRENT URL GOES HERE";
</script>