Reputation: 307
I have this Chrome Packaged App written in DART, and I want to allow tag to show the PDF comes as an attachment (Content-disposition:attachment; ) with HTTP response from an external link.Similar to the issue described here : Chrome packaged application - downloading file from Webview , but my app is in DART so there are some limitations. I am getting Permission error : ": The permission request for "download" has been denied." , I see a lot of examples on how to enable this from JS, but is there a way to do it with the Chrome API on DART ? or is there any other workaround to just display the PDF ?
Upvotes: 1
Views: 202
Reputation: 657248
You can try dart-js-interop
var webview = document.querySelector('#app-webview');
webview.on['permissionrequest'].listen((e) {
var evt = new js.JsObject.fromBrowserObject(e);
if (evt['permission'] == 'download') {
evt['request'].callMethod('allow', []);
}
});
Upvotes: 2