如何检测Web Share Target API的可用性?

时间:2019-01-22 03:27:45

标签: javascript progressive-web-apps

如果Web Share Target API可用,我想教给用户不同的流程。有没有办法检测它是否可用?

1 个答案:

答案 0 :(得分:0)

if (navigator.share === undefined) {
    console.log('Error: Unsupported  feature: navigator.share');
}

if (navigator.share === undefined) {
   alert('Error: Unsupported  feature: navigator.share');
}