简体   繁体   English

移动Web应用程序的“共享功能”

[英]'Share Functionality' for Mobile Web Apps

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'? 如果我在移动Web应用程序中添加“ mailto:”链接,则智能手机知道可以打开本机邮件应用程序,“共享”是否有类似内容?

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. 我问,因为在我的Android 2.2上,如果我使用浏览器的菜单选项“选择文本”,然后选择一些文本,则会看到“共享方式”选项,该选项打开一个本机对话框,其中包含通过gmail,facebook共享的选项,等等。。。我想从我的Mobile Web App触发此对话框。 Is this possible? 这可能吗?

Thanks in advance for any help, much appreciated as I couldn't figure it out on my own. 在此先感谢您的帮助,非常感谢,因为我无法自行解决。 :) :)

Here a tutorial but I don't know if it works for mobile web apps. 这里是一个教程,但我不知道它是否适用于移动Web应用程序。

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

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. 如果您的Web应用程序包装在本机层中(通过Phonegap或自己手动创建本机层),则您可以通过多种方式(例如,提供带有自定义协议的url的URL)来共享要共享给本机层的意图层拦截,或通过javascript回调函数),并将共享意向委托给您的本机层。

Any data needed to be shared can be parsed from the custom url or be passed as parameters in the callback function. 可以从自定义url解析任何需要共享的数据,或在回调函数中将其作为参数传递。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM