<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var xml = '<?xml version="1.0"?><foo><bar>bar</bar></foo>';
document.open("text/xml", "replace");
document.write(xml);
document.execCommand('SaveAs',true,'file.xml');
});
</script>
</head>
<body>
</body>
</html>
This html-file generates an xml file (in IE) and creates a “save as” dialog. However, I would like to reset the document to its previous state (before the “replace”) after I have saved the file. Is this possible using pure javascript or jQuery? Thanks
Run that code against the
documentfrom an<iframe>instead of replacing the current document.