SilverStripe 中的 TwitterWidget
我正在尝试将 TwitterWidget 集成到 SilverStripe 中。
这就是我正在尝试使用的插件: https://twitter.com/about/resources/widgets/widget_profile
如果我把这个代码在一个简单的 *.html 文件中,小部件可以工作。不幸的是,如果我尝试在 *.ss 文件中使用它,则会出现错误。
我下载了源代码来找出错误发生的地方。几个小时后,我发现一些非常令人困惑的事情:
这就是发生错误的代码片段:
document.write('
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对于调试来说有点不完整,但为什么不使用现成的小部件之一呢?就像 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/