-3

I'm using the LinkedIn share button in one website. In the head section of the website I included a linkedin script like that

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

Inside the body I have a button tag

<script type="IN/Share" data-url="some-data"></script>

When I try to validate my page with https://validator.w3.org/ I get the following error

The text content of element script was not in the required format: Expected space, tab, newline, or slash but found l instead.

The LinkedIn button does appear and it works as well, however I was wondering if there was another way to include a LinkedIn share button which is valid according to W3C. I got my code from the official LinkedIn documentation: https://developer.linkedin.com/docs/getting-started-js-sdk

Why did LinkedIn build a component which is not compliant with HTML specs?

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
Cyborg101
  • 67
  • 7
  • 2
    LinkedIn is doing something *really freaking weird* there. Not your fault, but it'll never validate. – ceejayoz Oct 18 '17 at 15:18
  • @Clive I have updated my question. Basically I wanted to know whether I was doing something wrong or whether it was a linkedin issue. It looks like it's the second – Cyborg101 Oct 18 '17 at 15:56

1 Answers1

2

To turn my comment into an answer, this is not your fault - LinkedIn is putting out extremely weird code here. It's not compliant. Looking at their JavaScript, it looks like they basically made their own little parser to pull data (in an almost-JSON but definitely not-JSON format) out of the text contents of the <script> tag.

Why did linkedin built a component which is not compliant with html specs?

That's a question only they can answer. My only answer to that question is "because they're insane". I'd love it if one of their devs came by and explained what sort of drugs they were smoking when this approach was proposed, approved, and built - there are many, many better, compliant ways of doing this sort of configuration.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368