【问题标题】:Can I open the native Android Share Dialogue when building app using WebView?使用 WebView 构建应用程序时可以打开原生 Android 共享对话框吗?
【发布时间】:2015-06-01 14:50:35
【问题描述】:

This article 告诉我可以做到,而this 说根本不可能。 我是否错误地阅读了链接?在 WebView 构建的 web 应用上设置分享按钮最有效的方法是什么?

【问题讨论】:

    标签: javascript android mobile webview share


    【解决方案1】:

    您可以使用 android 默认共享底页进行共享。 使用以下组件。

    if (navigator.share) {
        navigator.share({
        title: 'Web Fundamentals',
        text: 'Check out Web Fundamentals — it rocks!',
        url: 'https://developers.google.com/web',
    })
        .then(() => console.log('Successful share'))
        .catch((error) => console.log('Error sharing', error));
    }
    

    这可在使用网络时在 Android 设备上提供本机共享体验。

    【讨论】:

      猜你喜欢
      • 2016-05-30
      • 2021-01-09
      • 1970-01-01
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多