【问题标题】:Twitter button causing JS error in IE8 (Expected identifier)Twitter 按钮导致 IE8 中的 JS 错误(预期标识符)
【发布时间】:2015-02-03 05:52:36
【问题描述】:

我在我的页面上添加了一个 Twitter 按钮,使用的代码来自 https://about.twitter.com/resources/buttons

一个非常基本的实现看起来像这样

<!DOCTYPE html>
<html>

<head>
</head>

<body>

<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

</body>

</html>

在所有浏览器中都能完美运行,除了 IE8,它会触发错误:SCRIPT1010: Expected identifier 文件:widgets.js,行:1,列:29036

在文件https://platform.twitter.com/widgets.js

我看不出我的实现有什么错误。有谁知道,或者这真的是 Twitter 代码中的 IE8 错误吗?

【问题讨论】:

标签: javascript twitter internet-explorer-8


【解决方案1】:

根据Twitter widgets.js throws JavaScript error "Expected identifier" on IE8,Twitter 已于 2015 年 1 月停止支持 IE8。

因此,我的“解决方案”是使用条件 cmets <!--[if gt IE 8]><!--> TWITTER CODE HERE <!--<![endif]--> 来禁用 IE8 及更低版本中的推文按钮。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2022-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多