Is it possible to pre-populate the message in the LinkedIn Share plugin?
Asked Answered
O

3

3

We would like to use LinkedIn Share widget; however, we want to pre-populate the message with some default text. Is this possible?

Here is an example of the code for the plugin

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>
Odious answered 30/3, 2015 at 11:41 Comment(1)
Yes you can pre-poulate the text please refer to this link for detailsTheophilus
B
2

When you pass the share plugin a URL to share, LinkedIn's crawler visits the URL to attempt to pull data from the page directly (either from OpenGraph tags that are present, or by analyzing DOM elements like , 's, etc.)

If you want to change the content that is shared, you'd either have to modify those local DOM elements to match what you want to share if you are in control of the page yourself, or alternatively, you have to not use the widget and switch sharing via API call or via the URL pattern, both of which let you specify share data and avoid the crawler determining that on your behalf.

Additional documentation on sharing via API and URL can be found here: https://developer.linkedin.com/docs/share-on-linkedin

Boche answered 30/3, 2015 at 16:19 Comment(0)
A
2

Currently, you cannot pre-populate the message itself. The Official LinkedIn Sharing Documentation states that the following URL share format is the only acceptable one...

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

However!!! You can still have a preview of your site display for the person about to post the message. You would do this by means of og: tags...

  • <meta property='og:title' content='Title of the article"/>
  • <meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
  • <meta property='og:description' content='Description that will show in the preview"/>
  • <meta property='og:url' content='//www.example.com/URL of the article" />

Example results with og: tags...

Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.

And when you're all done, test out that you implemented everything correctly with the LinkedIn Post Inspector.

Actinia answered 1/6, 2020 at 14:27 Comment(0)
E
1

You could do that with text param.

window.open("https://www.linkedin.com/shareArticle?mini=true&text=what are you waiting for?&url=https://www.example.com", "linkedin", "height=500,width=550,resizable=1");

Attach an event handler to the above code to open in a new window.

Please refer https://developer.linkedin.com/docs/share-on-linkedin for further information.

Emptor answered 11/7, 2018 at 7:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.