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

℡╲_俬逩灬. 提交于 2019-12-13 14:59:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!