Reputation: 1
I want to display a LinkedIn Share Button on a webpage but if the button is in a tag then the form is posted and that's not I think what is intended. I know moving the button outside the FORM will fix this but I don't have control over the placing of the button. The reason I believe is that the button created by the LinkedIn code does not have the type set as 'type="button"' so defaults to type="submit".
<form action="anotherpage.htm">
<script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://www.linkedin.com"></script>
</form>
This is the default LinkedIn button from their help site. I would expect on clicking the button for the linkedin share window to pop-up but the underlying page to stay where it is. Actually the underlying page "posts" to the form action of "anotherpage.htm".
Upvotes: 0
Views: 64
Reputation: 20881
You don't need to rely on the LinkedIn Share Button API SDK and JS Bundle to have a share button. All you really ought to need is...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Then you can just make any button, using any HTML, CSS, or JavaScript that you like, and hyperlink it to allow sharing of a page.
Source: Microsoft LinkedIn Share URL Documentation.
Unfortunately, it seems that you have no other choice than this parameter to share: url
.
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
Upvotes: 0