简体   繁体   中英

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:

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:

!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:

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

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

The only thing that shows up is the link: Tweets by @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. Last I was aware, that has been officially shutdown, as noted here: https://dev.twitter.com/blog/planning-for-api-v1-retirement . I believe what you're getting is a 410 response, rather than JSON data. I'd suggest examining the response in Firebug or similar to verify this.

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

Also adbock plus blocks twitter widget(doesn't show up) on Firefox. I just figured this out today. I disabled the plugin and everything worked fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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