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

Images
Related searches

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 provide a share button. But when I e.g. want to share a website on facebook, I need to be logged in to facebook in the browser I am currently using.

Almost all browsers got an own share functionality build in, which triggers a system menu to choose which app you want to use to share:

This question is about: How to trigger this menu?

I know it is possible to trigger a phone call with a specified prefix in href attribute of links, like tel: or callto:. Maybe such a shortcut for this share menu is also existing? Or some javascript code? Or a totally different way how to do it?

Thanks in advance.

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! 🎉'))
    .catch(err => console.error(err));

Google's reference: https://developers.google.com/web/updates/2016/10/navigator-share

Also, there was a thing called Web Intends which is a dead project, you should go with navigator.share instead.

How to Use the Web Share API, javascript - Is it possible to trigger share menu on smartphones (via javascript android html ios share. 0. First you will need to write a class which fires the intent � 7 Is it possible to trigger share menu on smartphones (via HTML/JS)? May 15 '19. 5 How to open emacs gui/ide from mac terminal? Mar 1 '19. 4 How do I get python2.7

It is possible with a big catch. Currently only available in Chrome for Android and on Safari (desktop and mobile). http://caniuse.com/#feat=web-share

if (navigator.share) {
  navigator.share({
    title: document.title,
    text: "Hello World",
    url: window.location.href
  }).then(() => console.log('Successful share'))
  .catch(error => console.log('Error sharing:', error));
}

https://developers.google.com/web/updates/2016/10/navigator-share

Navigator.share(), Is it possible to trigger share menu on smartphones (via HTML/JS)?. Question. Is there an existing possibility to trigger the share functionality in local browsers� Senior Webdeveloper PHP/JS. Freelancer from Cologne, Germany 47 Is it possible to trigger share menu on smartphones (via HTML/JS)? 29 HTML input fields does

javascript, The Web Share API makes it possible for web apps to share links, text, and files to other Invoking it through the onload handler is impossible. html. Score 72. Posts 16. javascript. Score 55. Posts 51. node.js. Score 29. Posts 25. webpack. Score 24. Posts 23. 11 Is it possible to trigger share menu on

Is it possible to trigger share menu on smartphones (via HTML/JS)?, 7 Is it possible to trigger share menu on smartphones (via HTML/JS)? 6 What am I? (I really enjoy board games.) View more network posts → Top tags (48) 16.04. Score

You could use the WebView.addJavascriptInterface() method for android.

First you will need to write a class which fires the intent to open the share menu(take a look here) and then implement that class using the addJavascriptInterface() call. After that all you need to do is call the method from your Javascript.

Share like a native app with the Web Share API, Read more about deploying node.js apps to heroku here. If you use a different cloud hosting provider, the last three steps will be different. The Code. But enough talk, let's see the code! There are only two JavaScript files - app.js for the server side, and script.js for the browser. You can run the app in Node.js 0.10+ or in io.js.

31 Using HTML anchor link #id in Angular 6 13 How to use the tooltipTemplate on Chart.JS 2.0 Jan 29 '17. 9 Is it possible to trigger share menu on smartphones

I've only just started to think about usability on touch screen devices, such as smart phones or iPod Touch. For example, drop-down menus. These normally work by hovering over a menu option.

Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML.

Comments
  • Thanks! I've updated the correct answer :)
  • Worked perfectly! This is the valid answer.
  • I'm not familiar with writing apps on android. But this sounds like writing an app.