【发布时间】:2019-07-11 12:07:34
【问题描述】:
我正在开发一款适用于网络版和移动版的渐进式网络应用程序。我正在寻找一个共享选项来将我生成的 PDF 共享到 Whatsapp(或任何其他社交媒体,如 facebook、Messenger、LinkedIn)。 有什么帮助吗?
【问题讨论】:
标签: angular share progressive-web-apps
我正在开发一款适用于网络版和移动版的渐进式网络应用程序。我正在寻找一个共享选项来将我生成的 PDF 共享到 Whatsapp(或任何其他社交媒体,如 facebook、Messenger、LinkedIn)。 有什么帮助吗?
【问题讨论】:
标签: angular share progressive-web-apps
您可以使用网络Share API
if ('share' in navigator) {
navigator.share({
title: document.title,
text: text,
url: location.href,
})
} else {
// Here we use the WhatsApp API as fallback; remember to encode your text for URI
location.href = 'https://api.whatsapp.com/send?text=' + encodeURIComponent(text + ' - ') + location.href
}
【讨论】: