[Webkit-unassigned] [Bug 174076] New: There is no way for WKWebView to access or download blob subresource contents

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 2 02:08:16 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=174076

            Bug ID: 174076
           Summary: There is no way for WKWebView to access or download
                    blob subresource contents
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Macintosh
                OS: macOS 10.12.4
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit2
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dasau at microsoft.com

A popular library for download files in web browsers is https://github.com/eligrey/FileSaver.js/blob/master/FileSaver.js

The approach it takes is create a blob based resource such as "blob:https://localhost:3000/8acb6ff6-21d8-4345-afb6-9bf410bdd6ac", and then use the download attribute on the anchor to force the browser to download. We specifically use this technique to download an application/zip type file.
var click = function(node) {
                        var event = new MouseEvent("click");
                        node.dispatchEvent(event);

var save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
var object_url = get_URL().createObjectURL(blob);
setTimeout(function() {
    save_link.href = object_url;
    save_link.download = name;
    click(save_link);
});

This was not working in Safari until the download attribute was implemented in 10.1 with https://bugs.webkit.org/show_bug.cgi?id=102914. I do not see any way to get the above code working in macOS WKWebView with the public delegate methods currently exposed to developers. We either need WKWebView to handle saving the file for us, or preferrably implement a new delegate that receives the blob contents and lets the application decide how to handle this scenario.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170702/1f06a85b/attachment.html>


More information about the webkit-unassigned mailing list