Closed gaboluque closed 3 years ago
An implementation might give permission denied errors for a variety of reasons. In a StackOverflow answer, I might mention
I guess right now my options are reduced to 1 or 2. Which I've never seen any documentation about. How many files can I share? What is the top size?
I'll keep doing some trial and error, but seems like walking blind.
Thanks for the answer BTW, @ewilligers
Moving this discussion to StackOverflow, where it started.
@gaboluque Does https://stackoverflow.com/a/68314686/422957 work for you?
Hey @beaufortfrancois, I couldnt't really grasp the actual error, reducing the image size worked for now, I had to add a restriction for max 200kb, although this is not for overall files size (file1 + file2 + ...) but for single file size.
E.g I can share 5 200kb images but not 1 500kb image
According to https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webshare/navigator_share.cc;l=288;drc=eb07aa534eea81dac5aa15e1a8bbd4405bd1fb60;bpv=1;bpt=1, it should log some console errors if it was size related.
constexpr size_t kMaxSharedFileCount = 10;
constexpr uint32_t kMaxSharedFileBytes = 50U * 1024 * 1024;
...
if (files.size() > kMaxSharedFileCount ||
total_bytes > kMaxSharedFileBytes) {
execution_context->AddConsoleMessage(
mojom::blink::ConsoleMessageSource::kJavaScript,
mojom::blink::ConsoleMessageLevel::kWarning, "Share too large");
exception_state.ThrowDOMException(DOMExceptionCode::kNotAllowedError,
"Permission denied");
return ScriptPromise();
}
}
Yess exactly, I get the "Permission denied" error, this is really helpful!
Hey, I'm sure this should be addressed in another place like StackOverflow, but anyways...
I think there should be more documentation or better error descriptions for this web share api.
I'm trying to share the followeing file
I've made sure that the type is a permitted type, but I keep getting DOMException: Permission denied. I really don’t understand what should I be looking for.