SilverStripe 中的 TwitterWidget

发布于 2024-12-15 12:29:07 字数 1589 浏览 5 评论 0原文

我正在尝试将 TwitterWidget 集成到 SilverStripe 中。

这就是我正在尝试使用的插件: https://twitter.com/about/resources/widgets/widget_profile

如果我把这个代码在一个简单的 *.html 文件中,小部件可以工作。不幸的是,如果我尝试在 *.ss 文件中使用它,则会出现错误。

我下载了源代码来找出错误发生的地方。几个小时后,我发现一些非常令人困惑的事情:

这就是发生错误的代码片段:

document.write('

< ;/div>')

FireBug:

未捕获异常:[异常...“尝试使用不可用或不再可用的对象” code: “11” nsresult: “0x8053000b(NS_ERROR_DOM_INVALID_STATE_ERR)”位置:“http://www.domain.com/mysite/javascript/widget.js?m=1321187964行:257”] 左...8532904 (Zeile 883) function() {return new ActiveXObject('Microsoft.XMLHTTP')},

几次刷新后,FireBug 有时会报告:

尝试使用不可用或不再可用的对象 [Bei diesem Fehler anhalten] document.write('

')

Google Chrome JavaScript 调试器:

Uncaught TypeError: Object #<Document> has no method 'write'  //widget.js:257
TWTR.Widget.init                                              //widget.js:257
TWTR.Widget                                                   //widget.js:211
(anonymous function)                                          //?stage=Stage&flush=1:117
f.extend._Deferred.e.resolveWith                              //jquery-1.6.4.min.js:2
e.extend.ready                                                //jquery-1.6.4.min.js:2
c.addEventListener.C                                          //jquery-1.6.4.min.js:2

I am trying to integrate TwitterWidget within SilverStripe.

That's the plugin I am trying to use:
https://twitter.com/about/resources/widgets/widget_profile

If I put this code in a simple *.html file the widget works. Unfortunately I get an error if I try to use it in a *.ss file.

I downloaded the source code to find out where the error occurs. After several hours I found something pretty confusing:

That's the piece of code where the error occurs:

document.write('<div class="twtr-widget" id="'+this.id+'"></div>')

FireBug:

uncaught exception: [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (NS_ERROR_DOM_INVALID_STATE_ERR)" location: "http://www.domain.com/mysite/javascript/widget.js?m=1321187964 Line: 257"]
LeftAn...8532904 (Zeile 883)
function() {return new ActiveXObject('Microsoft.XMLHTTP')},

After a few refreshes sometimes FireBug reports:

An attempt was made to use an object that is not, or is no longer, usable
[Bei diesem Fehler anhalten] document.write('<div class="twtr-widget" id="'+this.id+'"></div>')

Google Chrome JavaScript Debugger:

Uncaught TypeError: Object #<Document> has no method 'write'  //widget.js:257
TWTR.Widget.init                                              //widget.js:257
TWTR.Widget                                                   //widget.js:211
(anonymous function)                                          //?stage=Stage&flush=1:117
f.extend._Deferred.e.resolveWith                              //jquery-1.6.4.min.js:2
e.extend.ready                                                //jquery-1.6.4.min.js:2
c.addEventListener.C                                          //jquery-1.6.4.min.js:2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终陌 2024-12-22 12:29:07

这对于调试来说有点不完整,但为什么不使用现成的小部件之一呢?就像 http://www.silverstripe.org/twitter-widget-pack-widget/< /a>

This is a little incomplete to debug, but why not use one of the readily available widgets? Like http://www.silverstripe.org/twitter-widget-pack-widget/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文