FIX: sharing popup not showing on macos/chrome
Despite `navigator.share` being defined the call was failing with this error: ``` sharing DOMException: Internal error: could not connect to Web Share interface. ```
This commit is contained in:
parent
474ff94df3
commit
40b3efacaa
|
@ -83,10 +83,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
_webShare(url) {
|
_webShare(url) {
|
||||||
// We can pass title and text too, but most share targets do their own oneboxing
|
// We can pass title and text too, but most share targets do their own oneboxing
|
||||||
navigator.share({
|
return navigator.share({ url });
|
||||||
url: url
|
|
||||||
})
|
|
||||||
.catch((error) => console.warn('Error sharing', error));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
@ -118,7 +115,13 @@ export default Ember.Component.extend({
|
||||||
// use native webshare only when the user clicks on the "chain" icon
|
// use native webshare only when the user clicks on the "chain" icon
|
||||||
// navigator.share needs HTTPS, returns undefined on HTTP
|
// navigator.share needs HTTPS, returns undefined on HTTP
|
||||||
if (navigator.share && !$currentTarget.hasClass('post-date')) {
|
if (navigator.share && !$currentTarget.hasClass('post-date')) {
|
||||||
this._webShare(url);
|
this._webShare(url)
|
||||||
|
.catch(error => {
|
||||||
|
console.warn('Error sharing', error);
|
||||||
|
|
||||||
|
// if navigator fails for unexpected reason fallback to popup
|
||||||
|
this._showUrl($currentTarget, url);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this._showUrl($currentTarget, url);
|
this._showUrl($currentTarget, url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue