ttencate / jfxr

A browser-based tool to create sound effects for games.
http://jfxr.frozenfractal.com/
429 stars 45 forks source link

Save/export not working on Firefox #14

Closed ttencate closed 10 years ago

ttencate commented 10 years ago

http://www.reddit.com/r/gamedev/comments/2ci8mo/announcing_jfxr_a_tool_to_quickly_make_sound/cjfxv41

sseemayer commented 10 years ago

Have the same problem as in the reddit thread using Firefox 31.0 on ArchLinux 64bit. Firebug console unfortunately gives no output. I'll try to step-by-step debug this on an unminified build of the code and will report back what I find.

sseemayer commented 10 years ago

It looks like the creation of the .WAV Blob is still working fine but your method of downloading a blob does not seem to work in Firefox because click() is ignored on elements that are not in the DOM.

With the following hack, downloading the blob works fine in my browser:

  var download = function(blob, filename) {
    var link = document.createElement('a');
    link.href = URL.createObjectURL(blob);
    link.download = filename;
    document.body.appendChild(link);
    link.click();
    // Revoking is tricky:
    // https://code.google.com/p/chromium/issues/detail?id=375297#c7
    window.setTimeout(function() {
      URL.revokeObjectURL(blob);
      document.body.removeChild(link);
    }, 0);
  };
swapnilchincholkar commented 6 years ago

@sseemayer Your solution worked for me in other scenario. For chrome v65 onwards cross origin downloads are not working & there your code worked like charm. Thanks!!