[Webkit-unassigned] [Bug 197779] New: Using Web Share API preceded by an AJAX call
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri May 10 09:14:44 PDT 2019
https://bugs.webkit.org/show_bug.cgi?id=197779
Bug ID: 197779
Summary: Using Web Share API preceded by an AJAX call
Product: WebKit
Version: Safari 12
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebKit API
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mkonikov at gmail.com
When users click the share button on our paywalled site, we generate a token via an async call that allows the people clicking on the share link to bypass the paywall.
I've added support for Web Share API first calling the token before triggering navigator.share - along these lines:
fetchCallForLink()
.then((url) => {
navigator.share({
title: 'Test Title',
url,
});
This is working fine on Chrome / Android which supports Web Share.
However on Safari, I am getting a not allowed error.
>The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission
(This only happens on the first share attempt as I save the response to the window and therefore on subsequent clicks it avoids the AJAX call and works just fine.)
Because of the number of readers we have and the small number that actually use the share option, it would be expensive to make the AJAX call for ever page load (vs. only when user expresses intent to share).
Example: https://mkonikov.com/web-share-testing/ I've added a toggle to share with or without fetching first. This share fails only when fetch is enabled. (or with a setTimeout of over 1000ms - though as seen in the example, it fails immediately if share is preceded by an AJAX/fetch call)
--
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/20190510/0264c8db/attachment.html>
More information about the webkit-unassigned
mailing list