2

I am using the below Share Plugin of LinkedIn in my ReactJS app:

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

From LinkedIn Docs: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/plugins/share-plugin

It is working completely fine on Chrome/Firefox/Safari. But, on clicking the LinkedIn Share button (generated by the above scripts), the LinkedIn Share Popup appears and I get an error in my app console which says:

[object Error]: {description: "[Messenger] Required property 'target' was not provided", message: "[Messenger] Required property 'target' was not provided", nr@seenError: true, stack: "Error: [Messenger] Required property 'target' was not provided at Anonymous function (https://platform.linkedin.com/xdoor/scripts/in.js:7:55143) at Array.prototype.forEach (native code) at t (https://platform.linkedin.com/xdoor/scripts/in.js:7:54936) at e (https://platform.linkedin.com/xdoor/scripts/in.js:7:56462) at e (https://platform.linkedin.com/xdoor/scripts/in.js:7:34661) at value (https://platform.linkedin.com/xdoor/scripts/in.js:18:23834) at s (https://platform.linkedin.com/xdoor/scripts/in.js:18:38221) at nrWrapper ([MY_SITE_LINK_ADDRESS]:9:16587)"}

Note: I hid the [MY_SITE_LINK_ADDRESS].

Himanshu Aggarwal
  • 1,803
  • 2
  • 24
  • 36
  • 2
    I made a test with above sample code. Share button displayed fine in all the browsers including IE and Edge. when I click on it, I got different errors in all the browsers including Chrome. You can also make a test by just running above 2 line on your web page to see the errors. If we check your console error than also it says that those are script files from Linkedin. So most possible that they have some issues with their site or plugin. As the error shows in their files, We cannot correct it from our side. – Deepak-MSFT Mar 19 '19 at 02:41

1 Answers1

0

The problem here seems to be that you're relying on the plugin's JS, CSS, and HTML to handle every browser. Take a look: Here's someone else posting in 2018 having the same exact problem, Issue on IE with LinkedIn Share plugin. And, officially from LinkedIn, if you want this plugin to work, you need to ask your users to do this:

  1. Open Internet Explorer.
  2. Click Tools and select Compatibility View Settings.
  3. Uncheck the box next to "Display all websites in compatibility view".
  4. Click Close.

Is it reasonable to ask your users to reconfigure their browser just to be able to click one, single button on your website? Answer: No.

You don't need to rely on the LinkedIn Share Plugin. All you really ought to need is...

https://www.linkedin.com/sharing/share-offsite/?url={url}

Then making sure it works cross-browser is in your hands.

Source: Microsoft LinkedIn Share URL Documentation.

Sure, everyone says: Don't Reinvent the Wheel! I totally agree! But when you find a car that has square, cubic wheels, then maybe you want to reconsider!

If you are interested in a regularly maintained GitHub project that keeps track of this so you don't have to, check it out! Social Share URLs

Social Share URLs Image

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133