问题
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>
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/29345308/is-it-possible-to-pre-populate-the-message-in-the-linkedin-share-plugin