I would like to bring up the Android Share menu from Javascript in Chrome for Android. I know that you can launch a specific app from Chrome:
Is there a way to use href="intent://..." to open the Share menu? This is how it is done in an app: .html
I would like to bring up the Android Share menu from Javascript in Chrome for Android. I know that you can launch a specific app from Chrome: https://developers.google./chrome/mobile/docs/intents
Is there a way to use href="intent://..." to open the Share menu? This is how it is done in an app: http://developer.android./training/sharing/shareaction.html
Share Improve this question asked Oct 9, 2013 at 23:46 PiwakawakaPiwakawaka 5196 silver badges16 bronze badges 1- here is solution sdtuts./… – Rameez SOOMRO Commented Mar 15, 2018 at 19:52
4 Answers
Reset to default 5There is navigator.share
as an experimental technology mentioned in MDN.
Also described more in Google Developers page.
From chrome 61 you can do this, here is demo I found online. I've tested it on latest Android Chrome (on Android Oreo) and it works fine.
The quick answer is you can't.
I made this sample: http://jsbin./AdAPEmu/2 which constructs the Intent as it would appear for Android and Chrome doesn't recognise it, it needs a package to go with it.
This article, Triggering a native Share intent on Android from the web, may provide more details about why triggering intents from a web page doesn't currently work as well as it could.
So, yes, apparently you can make this work, but probably only with your own target applications (applications for which you have control over the manifest).
You can you the Web Share API. The documents has different examples for sharing text and files.
You may also take a look at the list of Browser Support for Web Share API
shareButton.addEventListener("click", async () => {
try {
await navigator.share({ title: "Example Page", url: "" });
console.log("Data was shared successfully");
} catch (err) {
console.error("Share failed:", err.message);
}
});