append a page's URL to a social media 'sharing' URL - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open

Description

append a page's URL to a social media 'sharing' URL

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script>
    function shareOnLinked(url, title, summary)
    {//ww w.  j ava  2s  .  c om
     window.open('http://www.linkedin.com/shareArticle?mini=true&url='+ url +'&title='+title+'&summary='+summary);
    }

      </script> 
      <a href="#" onclick="shareOnLinked(&quot;http://java2s.com&quot;,&quot;Gideon&quot;,&quot;Some Summary&quot;);"> Share On Linked in</a>  
   </body>
</html>

Related Tutorials