'Share Functionality' for Mobile Web Apps

主宰稳场 提交于 2019-12-11 11:04:18

问题


If I add a 'mailto:' link to my Mobile web app, smartphones know to open up the native mail app, is there something similar for 'sharing'?

I ask because on my Android 2.2, if I 'select text' using the browser's menu option, and then I select some text, I get presented with a 'share via' option that opens a native dialog with options to share via gmail, facebook, etc... I'd like to trigger this dialog from my Mobile Web App. Is this possible?

Thanks in advance for any help, much appreciated as I couldn't figure it out on my own. :)


回答1:


Here a tutorial but I don't know if it works for mobile web apps.

http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/




回答2:


If your web app is wrapped in a native layer (via Phonegap or by manually creating the native layer yourself), you can communicate your intention to share to the native layer by various means (like providing a url with a custom protocol that only your native layer intercepts, or via javascript callback functions) and delegate the share intent to your native layer.

Any data needed to be shared can be parsed from the custom url or be passed as parameters in the callback function.



来源:https://stackoverflow.com/questions/9190446/share-functionality-for-mobile-web-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!