javascript - 使用 Linkedin 代码登录给我 html 验证错误

标签 javascript html oauth-2.0 w3c-validation linkedin-api

我正在使用 https://validator.w3.org验证我的 HTML 5 网站。我正在使用 Linkedin javascript 登录 SDK。我遵循了本教程 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 的有效代码

关于javascript - 使用 Linkedin 代码登录给我 html 验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33882617/

相关文章:

javascript - 如果悬停速度非常快,Jquery mousemove 会错过一些单元格

javascript - 使用 Chart.JS 显示单个工具提示?

html - 无法弄清楚这个额外的空间来自哪里

java - Google 端点 - Android GoogleAuthIOException Tic Tac Toe - 删除了 clientIds

oauth-2.0 - 获取 OAuthProblemException : invalid_request for Google when using OLTU

javascript - 在 Javascript 中控制 ASP.Net TreeView

html - 空白 : pre-line for small cell

html - 3 列布局 : Fixed Positions for Divs

java - Google Cloud Endpoints Security (OAuth2) 和自定义用户架构

javascript - 对象字符串数组仅转换为对象数组 javascript