问题
My website has a LinkedIn Share button at the top. This seems to be working fine in Chrome, Firefox, & IE. With Edge, however, we get this ugly error message:
I used the Share Plugin Generator on LinkedIn's developer portal which generated this script:
<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-url="https://www.aoccorp.com"></script>
Why is this not working in Edge while it works in the other browsers?
Thanks, Steve
Update: Interestingly, I experience the same behavior in LinkedIn's own developer blog (https://developer.linkedin.com/blog/posts/2018/deprecating-the-inshare-counter).
回答1:
Thank you for raising this issue! There is a known compatibility issue with LinkedIn plugins and Microsoft Edge. While our teams are currently working on a solution, you will continue to see these types of errors with Microsoft Edge.
回答2:
Solution: Do NOT use the LinkedIn Share Library.
Take a look: Here's someone else posting in 2018 having the same exact problem, Issue on IE with LinkedIn Share plugin. And here's another person: Error on clicking the LinkedIn Share Button on IE/Edge in 2019. And, officially from LinkedIn, if you want this plugin to work, you need to ask your users to do this:
- Open Internet Explorer.
- Click Tools and select Compatibility View Settings.
- Uncheck the box next to "Display all websites in compatibility view".
- 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
来源:https://stackoverflow.com/questions/50357798/linkedin-share-button-doesnt-work-in-microsoft-edge