简体   繁体   English

Twitter活动供稿不起作用

[英]twitter activity feed not working

For the project I am loading icimod twitter dynamically (only when twitter is called I load the twitter).My code is: 对于该项目,我正在动态加载icimod twitter (仅当调用twitter时才加载twitter)。我的代码是:

function _twitter_data(pos, type, hover, showimg,stat, controllerId){
        var parents = $('input#'+pos).parents('div.wrapitem');
        parents.find('div.description').html('Processing...').fadeIn();
        var url = 'assets/scripts/twitter.js';
        $.getScript(url)
            .done(function(){
               parents.find('div.item').append('<div class="description disp hover"><a class="twitter-timeline"  href="https://twitter.com/icimod"  data-widget-id="374478558938148864">Tweets by @icimod</a></div>'); 

            });
   }

In twitter.js I have following: twitter.js中,我有以下内容:

!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");

Now when I load the twitter in console it gives the following error: 现在,当我在控制台中加载twitter时,会出现以下错误:

SyntaxError: syntax error <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//E

in http://platform.twitter.com/widget.js http://platform.twitter.com/widget.js中

The only thing that shows up is the link: Tweets by @icimod 唯一显示的是链接: @icimod的推文

Can anyone suggest what am I doing wrong? 谁能暗示我在做什么错? Any help/suggestions are welcome. 欢迎任何帮助/建议。

I'm assuming the widget in question was built for v1 of the Twitter timeline. 我假设有问题的小部件是为Twitter时间轴的v1构建的。 Last I was aware, that has been officially shutdown, as noted here: https://dev.twitter.com/blog/planning-for-api-v1-retirement . 最后我知道,它已经正式关闭,如下所示: https : //dev.twitter.com/blog/planning-for-api-v1-retirement I believe what you're getting is a 410 response, rather than JSON data. 我相信您得到的是410响应,而不是JSON数据。 I'd suggest examining the response in Firebug or similar to verify this. 我建议检查Firebug或类似的响应以验证这一点。

我实际上不确定,但是我认为问题是由于我的PC中阻止了Twitter。

Also adbock plus blocks twitter widget(doesn't show up) on Firefox. 另外adbock plus会阻止Firefox上的twitter小部件(不显示)。 I just figured this out today. 我今天才想通了。 I disabled the plugin and everything worked fine! 我禁用了插件,一切正常!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM