Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / third_party / jszip / examples / download-zip-file.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <title>JSZip example : download the generated zip file</title>
6
7 <link media="screen" href="style.css" type="text/css" rel="stylesheet">
8
9 <script type="text/javascript" src="../jszip.js"></script>
10 <script type="text/javascript">
11 window.onload = function () {
12   var zip = new JSZip();
13   zip.file("Hello.txt", "Hello world\n");
14
15   // data URI
16   document.getElementById('data_uri').href = "data:application/zip;base64," + zip.generate();
17
18   // Blob
19   var blobLink = document.getElementById('blob');
20   try {
21     blobLink.download = "hello.zip";
22     blobLink.href = window.URL.createObjectURL(zip.generate({type:"blob"}));
23   } catch(e) {
24     blobLink.innerHTML += " (not supported on this browser)";
25   }
26 };
27 </script>
28 </head>
29 <body>
30 <h1><a href="../">JSZip</a> example : download the generated zip file</h1>
31 <p>Tip : check the source of the page !</p>
32 <h2>The data URL</h2>
33 <div>
34   <a href="#" id="data_uri">click to download</a>
35 </div>
36 <h2>The Blob URL</h2>
37 <div>
38   <a href="#" id="blob">click to download</a>
39 </div>
40 </body>
41 </html>