Skip to content

A platform for community discussion. Free, open, simple.

FIX: sharing popup not showing on macos/chrome

Joffrey JAFFEUX40b3efacaa4a
diff --git a/app/assets/javascripts/discourse/components/share-popup.js.es6 b/app/assets/javascripts/discourse/components/share-popup.js.es6
index 54ffeaa21fa..5705f3be594 100644
--- a/app/assets/javascripts/discourse/components/share-popup.js.es6
+++ b/app/assets/javascripts/discourse/components/share-popup.js.es6
@@ -83,10 +83,7 @@ export default Ember.Component.extend({
_webShare(url) {
// We can pass title and text too, but most share targets do their own oneboxing
- navigator.share({
- url: url
- })
- .catch((error) => console.warn('Error sharing', error));
+ return navigator.share({ url });
},
didInsertElement() {
@@ -118,7 +115,13 @@ export default Ember.Component.extend({
// use native webshare only when the user clicks on the "chain" icon
// navigator.share needs HTTPS, returns undefined on HTTP
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 {
this._showUrl($currentTarget, url);
}