Error when using LinkedIn's Share button
Asked Answered
F

6

6

I'm attempting to add a LinkedIn Share button to our content-driven website. I've generated the embed code using the button builder, but whenever I try to actually use the button, I get a generic error:

There was a problem performing this action, please try again later.

It's been doing this for several days (since I first added the code), so I don't know if the error is on the LinkedIn side or mine. Is there any way to get a more specific error message? The code they provide is just a script tag that you paste in:

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share"></script>

Unfortunately LinkedIn's "support" forums are limited to the various API's; there's nowhere available to submit a question regarding the build-a-button functionality. I'm hoping someone else has used this function and can point me in the right direction.

Fab answered 2/5, 2011 at 19:31 Comment(0)
P
7

Most likely the page you are trying to share is not web accessible (local, under htaccess password or something). It looks to me like LinkedIn tries to actually look at the page you are sharing, and if it can't reach it, it gives you this message.

Peridium answered 27/5, 2011 at 7:25 Comment(2)
Yes, that's exactly what's happening. We have apache digest authentication on our dev server and it's blocking the connection. We just figured it out a few days ago.Fab
Also, check your page for any 403 errors by looking in the network panel. We discovered a few and, upon resolving, the share started working correctly.Flashcube
B
0

Most likely the url which you are sharing is not encoded, try encoding that, also follow this article for more.

Baht answered 2/5, 2011 at 19:54 Comment(4)
Not sure how to encode it in this case; the create-a-button code is just a link to a hosted .js file. Since the button is going on all of our content pages, I chose to leave the URL blank in the "wizard" since it indicates that it defaults to the current URL. I'll take a look at the link, but we're not actually use the API, just the "wizard" that generates the button code that you just paste in.Fab
Have you tested it with live site, i mean not on local machine? I am also facing same issue on my local but it is working on live site. they also clearly mention that the default url will be the live sites url(if you not pass any url). jsfiddle.net/aXezN check this test.Baht
This is a "live" site - it's a dev machine, but not local.Fab
Well, I tried my exact same code (which is already posted in the original message) on one of my hosted domains and it works fine, so I'm guessing the reason it's not working on our dev server may be because of the apache authentication. We'll just have to try it on our live server and see what happens.Fab
G
0

The easiest way to ensure the linkedin share button works properly, is to use

<!DOCTYPE html>

instead of other alternatives.

Gemoets answered 14/12, 2011 at 22:19 Comment(0)
V
0

I found this way for validate in xhtml:

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

< script src="http://platform.linkedin.com/in.js" type="text/javascript">< /script>

< div id="linkedin">< /div>

< script type="text/javascript">
var po2 = document.createElement('script');     
po2.type = 'IN/MemberProfile';     
po2.setAttribute("data-id","http://www.linkedin.com/pub/luca-di-lenardo/11/4b7/3b8");    
po2.setAttribute("data-format","hover");    
po2.setAttribute("data-text","Luca Di Lenardo");    
document.getElementById("linkedin").appendChild(po2);       
< /script>

Remove the white space and it works!

Vidovik answered 28/4, 2012 at 8:12 Comment(1)
Not sure what this has to do with anything; if you read the entire post you'll see that I accepted an answer, indicating the issue had to do with apache digest authentication on our dev server. Also, if you're posting code, all of the code should be inside the code formatter (i.e. type your code, select it all, then click the code format button.)Fab
S
0

look at the data-url attrbute. Remove the "http://" and only use "www." for your website url. That fixed my issue at least.

Swish answered 14/6, 2012 at 21:33 Comment(1)
Did you not see that I accepted an answer? The issue was apache digest authentication.Fab
V
0

If anyone is getting this error, and cannot figure out why, I recommend checking the URL of the page you're sharing with: LinkedIn Post Inspector.

So, for instance, if I were to check out how wikipedia.org looks when shared, I would visit and enter that URL, like so...

https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fwww.wikipedia.org%2F

And I see...

But there's a ton of information here, showing how everything is parsed, from the description to the title to the image selection for thumbnail display...

Warning: Add an og:image tag to the page to have control over the content's image on LinkedIn.

Title: Wikipedia

Type: Article

Image: No image found

Description: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world and hosted by the Wikimedia Foundation.

Author: No author found

Publish date: 6/1/2020, 6:39:59 AM

They even give you instructions on how to fix your page! Hey, got some advice for Wikipedia.org here!

Provide a metadata tag for the og:image in the page's head section. For example:

<meta name="image" property="og:image" content="[Image URL here]">

Viki answered 1/6, 2020 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.