未被捕获的参考错误:stLight没有定义(仅在Chrome中)

时间:2022-11-05 14:49:07

My web page ends thus:

我的网页就此结束:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">var switchTo5x=false;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
stLight.options({publisher: "ur-24e62f76-1f66-e3aa-1190-c533b729ca11", doNotHash: true, doNotCopy: true, hashAddressBar: false});
</script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.js"></script>  
</body>
</html>

In FireFox and Safari, it behaves. In Chrome:

在FireFox和Safari中,它会运行。铬:

Uncaught ReferenceError: stLight is not defined nectar-tugg-art:229
(anonymous function)

In other words, the code at w.sharethis.com/button/buttons.js has failed to execute, and hence, failed to define the stLight variable.

换句话说,wsharethis.com/button/buttons.js的代码执行失败,因此无法定义stLight变量。

The page is part of a Django web application running on a remote server. Saving the generated HTML page locally, then viewing in Chrome, works correctly.

该页面是在远程服务器上运行的Django web应用程序的一部分。在本地保存生成的HTML页面,然后在Chrome中查看,工作正常。

At this point I'm stuck. Something to do with the cross domain security model? There aren't any security exceptions.

现在我被困住了。与跨域安全模型有什么关系?没有任何安全异常。

Some weird interaction with the other javascript files?

与其他javascript文件进行奇怪的交互?

The static (generated) code is here. It won't run from Dropbox though.

这里是静态(生成的)代码。不过它不会在Dropbox上运行。

6 个解决方案

#1


21  

Ok, think I may have found it: the site runs fine in Chrome's incognito (porn) mode. So I strongly suspect I've got some kind of extension that's interfering with it (like Do Not Track or something).

好吧,我想我可能找到了:这个网站在Chrome的隐身模式下运行良好。所以我强烈怀疑,我有某种扩展,它干扰了它(比如不跟踪或其他东西)。

EDIT It's Collusion's "block known tracking sites" feature.

编辑它的勾结“*已知的跟踪网站”的特性。

#2


8  

In my case I found it to be a Chrome plugin called "Disconnect". Thanks to @SteveBennet for the clue.

在我的例子中,我发现它是一个叫做“断开连接”的Chrome插件。感谢@SteveBennet的提示。

#3


3  

In my case I replaced

以我为例,我替换了

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>

this by

通过

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>

ShareThis

ShareThis

#4


2  

In Magento stLight is not defined: This can be resolved by following: <script type="text/javascript"> window.onload = function(){ stLight.options({publisher: "ur-24e62f76-1f66-e3aa-1190-c533b729ca11", doNotHash: true, doNotCopy: true, hashAddressBar: false});} </script>

在Magento stLight中没有定义:可以通过以下方法来解决:

Issue (I think) is js file http://w.sharethis.com/button/buttons.js load after the script in which this function exists. so easiest solution in my mind is window.onload, may have other good solutions.

问题(我想)是js文件http://w.sharethis.com/button/buttons.js load,在该函数存在的脚本之后。我脑海中最简单的解决方案就是window。onload,可能有其他好的解决方案。

#5


0  

This can be caused by the Ghostery extension, in addition to the extensions listed in the other answers.

这可能是由Ghostery扩展引起的,除了在其他答案中列出的扩展之外。

#6


0  

If you switched on the SSL on your site, you might want to try re-writing your ShareThis script:

如果你在你的网站上打开SSL,你可能想尝试重写你的ShareThis脚本:

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
  stLight.options({
    publisher:'12345',
  });
</script>

#1


21  

Ok, think I may have found it: the site runs fine in Chrome's incognito (porn) mode. So I strongly suspect I've got some kind of extension that's interfering with it (like Do Not Track or something).

好吧,我想我可能找到了:这个网站在Chrome的隐身模式下运行良好。所以我强烈怀疑,我有某种扩展,它干扰了它(比如不跟踪或其他东西)。

EDIT It's Collusion's "block known tracking sites" feature.

编辑它的勾结“*已知的跟踪网站”的特性。

#2


8  

In my case I found it to be a Chrome plugin called "Disconnect". Thanks to @SteveBennet for the clue.

在我的例子中,我发现它是一个叫做“断开连接”的Chrome插件。感谢@SteveBennet的提示。

#3


3  

In my case I replaced

以我为例,我替换了

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>

this by

通过

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>

ShareThis

ShareThis

#4


2  

In Magento stLight is not defined: This can be resolved by following: <script type="text/javascript"> window.onload = function(){ stLight.options({publisher: "ur-24e62f76-1f66-e3aa-1190-c533b729ca11", doNotHash: true, doNotCopy: true, hashAddressBar: false});} </script>

在Magento stLight中没有定义:可以通过以下方法来解决:

Issue (I think) is js file http://w.sharethis.com/button/buttons.js load after the script in which this function exists. so easiest solution in my mind is window.onload, may have other good solutions.

问题(我想)是js文件http://w.sharethis.com/button/buttons.js load,在该函数存在的脚本之后。我脑海中最简单的解决方案就是window。onload,可能有其他好的解决方案。

#5


0  

This can be caused by the Ghostery extension, in addition to the extensions listed in the other answers.

这可能是由Ghostery扩展引起的,除了在其他答案中列出的扩展之外。

#6


0  

If you switched on the SSL on your site, you might want to try re-writing your ShareThis script:

如果你在你的网站上打开SSL,你可能想尝试重写你的ShareThis脚本:

<script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">
  stLight.options({
    publisher:'12345',
  });
</script>