使用 Linkedin 代码登录时出现 html 验证错误

signin with Linkedin code give me html validation error

我正在使用 https://validator.w3.org to validate my HTML 5 website. I'm using Linkedin javascript login SDK. I followed this tutorial https://developer.linkedin.com/docs/signin-with-linkedin

我遇到了这个错误

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

在此代码块中

<script type="text/javascript" src="//platform.linkedin.com/in.js">
  api_key: YOUR_API_KEY_HERE
  authorize: true
  onLoad: onLinkedInLoad
</script>

本教程提供的代码问题

我通过分离 API 的加载和 API 的启动解决了这个问题。

<script src="http://platform.linkedin.com/in.js?async=true"></script>

<script>
IN.init({
    api_key: 'YOUR_API_KEY_HERE',
    onLoad: onLinkedInLoad,
    authorize: true,
    scope: 'r_basicprofile r_fullprofile r_emailaddress r_contactinfo',
});
</script>

此代码是 W3C 的有效代码