Is it possible to trigger share menu on smartphones (via HTML/JS)?

后端 未结 6 1172
半阙折子戏
半阙折子戏 2020-12-04 21:13

Is there an existing possibility to trigger the share functionality in local browsers on smartphones via HTML or JavaScript?

Of course there are many services which

6条回答
  •  庸人自扰
    2020-12-04 21:55

    I added this as all answers seems outdated by 2018-07-16.

    It is possible, but only in a few browsers (MDN Reference), achieved througth the one method API in navigator:

    navigator
        .share({
            title: document.title,
            text: 'Hello World',
            url: window.location.href
        })
        .then(() => console.log('Successful share! 

提交回复
热议问题