Skip to content

Instantly share code, notes, and snippets.

@Stuk
Created April 11, 2011 19:42
Show Gist options
  • Save Stuk/914161 to your computer and use it in GitHub Desktop.
Save Stuk/914161 to your computer and use it in GitHub Desktop.
<!doctype HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
</head>
<body>
<script type="text/javascript" src="jszip.js"></script>
<script type="text/javascript" src="jszip-deflate.js"></script>
<script type="text/javascript" src="test.js"></script>
<input type="button" value="a" onclick="a()" />
</body>
</html>
function a() {
var zip = new JSZip("DEFLATE");
zip.add("test.html", '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">\n'+
'\n'+
'<head> <title>DraftZIPFiles</title> <script src="../lively/bootstrap.js"></script><meta id="WorldChangeSet"><code xmlns="http://www.w3');
content = zip.generate();
location.href="data:application/zip;base64,"+content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment