Skip to content

Update documentation #101

Merged
merged 6 commits into from Feb 22, 2014

3 participants

@dduponchel
Collaborator

For issue #96, make the example works in IE 10.
For issue #100, add an example for binary content in the migration guide.

dduponchel added some commits Feb 15, 2014
@dduponchel dduponchel update the example to work with IE 10/11 6299509
@dduponchel dduponchel update documentation for blob url
See Stuk/jszip#96 : we still don't have a solid, cross brower way to
download the zip file...
159dda7
@dduponchel dduponchel doc : add a note about IE's compatibility view 98c7281
@dduponchel dduponchel migration guide : add .asBinary() to the example
Fix issue #100 : the migration guide said that the equivalent of .data
is .asText() but the utf8 conversion is not always welcomed.
973b44a
@Stuk Stuk commented on an outdated diff Feb 19, 2014
examples/download-zip-file.html
@@ -27,14 +29,32 @@
zip.file("Hello.txt", "Hello world\n");
// data URI
- document.getElementById('data_uri').href = "data:application/zip;base64," + zip.generate();
+ var dataUriLink = document.getElementById('data_uri');
+ dataUriLink.onclick = function () {
@Stuk
Owner
Stuk added a note Feb 19, 2014

I'd rather propagate good practice with dataUriLink.addEventListener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Stuk Stuk commented on an outdated diff Feb 19, 2014
examples/download-zip-file.html
// Blob
var blobLink = document.getElementById('blob');
- try {
- blobLink.download = "hello.zip";
- blobLink.href = window.URL.createObjectURL(zip.generate({type:"blob"}));
- } catch(e) {
+ var saveAs = window.saveAs || (navigator.msSaveBlob && navigator.msSaveBlob.bind(navigator))
+ var blobDownloadSupported = JSZip.support.blob && (saveAs || window.URL && window.URL.createObjectURL);
+ if (blobDownloadSupported) {
+ blobLink.onclick = function () {
@Stuk
Owner
Stuk added a note Feb 19, 2014

addEventListener please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Stuk
Owner
Stuk commented Feb 19, 2014

Otherwise looks great!

@dduponchel dduponchel use addEventListener instead of onclick
Also use attachEvent as a fallback. This page will only works with
everything but old IE so this fallback will only be useful to display
error messages in IE 8 :)
86c4cb4
@dduponchel
Collaborator

You're right, I used the easiest path (good old ugly onclick, working even in IE6), not the prettiest :) Fixed.

@Mithgol
Mithgol commented Feb 21, 2014

@dduponchel While you are at it, could you also mention in the docs that the new operator has become optional before the JSZip constructor (#93)?

@dduponchel
Collaborator

done !

@Stuk Stuk merged commit b516468 into Stuk:master Feb 22, 2014

1 check passed

Details default The Travis CI build passed
@dduponchel dduponchel deleted the dduponchel:update_doc branch Feb 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.