0

I am embedding LinkedIn share button using script tags given me by Share Plugin Generator.

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

When I add it to the footer of my site it sets the document.onreadystatechange.

document.onreadystatechange = function() {
    if (document.readyState === 'complete') {
//  some code run here  
}}

to null.

How can I prevent it from overriding my onreadystatechange event?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
RuvenGam
  • 64
  • 1
  • 9

1 Answers1

0

The plugin generator also generates code, JavaScript, which controls the behavior of the plugin buttons. In fact, I should say WAS, because that plugin generator has been taken offline, and virtually all of the LinkedIn documentation from 2015 now 404.

All you need is a simply linked button, using this URL...

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

Source: Microsoft LinkedIn Share URL Documentation.

For example, this works for me:

https://www.linkedin.com/sharing/share-offsite/?url=http://www.wikipedia.org/

Works fine:

So, just link a native to that URL and control it naturally through your own JavaScript.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133