Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a simple share linkedIn link?

I am using the followings for twitter, facebook and google+ but the linkedin gives me an error dialog box:

<a class="btn btn-default icon" href="javascript:void(0)" onclick="window.open( 'http://www.twitter.com/share?url=<?php the_permalink(); ?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Share on Twitter"><span class="character">a</span></a>

<a class="btn btn-default icon" href="javascript:void(0)" onclick="window.open( 'http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Share on Facebook"><span class="character">b</span></a>

<a class="btn btn-default icon" href="javascript:void(0)" onclick="window.open( 'https://plus.google.com/share?url=<?php the_permalink(); ?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Share on Google+"><span class="character">c</span></a>

<a class="btn btn-default icon" href="javascript:void(0)" onclick="window.open( 'https://www.linkedin.com/share?url=<?php the_permalink(); ?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Share on Google+"><span class="character">j</span></a>

Error

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<WSResponse>
  <responseInfo>FAILURE_NO_SUBMIT_ACTION</responseInfo> <responseMsg/>
  <jsonPayLoad/> 
</WSResponse>

Note

<?php the_permalink(); ?> renders the link of the current site page that you could share on socials networks

like image 683
rob.m Avatar asked Apr 20 '15 09:04

rob.m


2 Answers

I think the problem is you are not doing it in the way linkedin asked to you. You should always refer to API docs first. For example below linkedin describe how you can generate Share Plugin for your site.

Share Plugin Generator

and the code generated is looks like:

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-url="Your_URL_Here" data-counter="top"></script>

Also you can do it in following way:

https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn

Reference: Share on Linkedin

Your link will look like:

https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=Some%20Title&summary=Some%20Summary&source=YourWebsiteName

Where mini parameter is for: A required argument who's value must always be: true

and Source is: The url-encoded source of the content (e.g. your website or application name) Please let me know if you still needs to know how it will work for you.

And all parameters must be URL Encoded.

like image 160
Imran Avatar answered Sep 30 '22 20:09

Imran


I use this very simple sharer:

<a href="https://www.linkedin.com/sharing/share-offsite/?url=your-url-here.com"target="_blank" title="Share on LinkedIn">
Share on LinkedIn
</a>

This is how it looks like: Example of using simple LinkedIn sharer in Google Chrome

like image 21
Nikola Avatar answered Sep 30 '22 20:09

Nikola