最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Why is my JavaScript Twitter feed not working in Internet Explorer? - Stack Overflow

programmeradmin1浏览0评论

We're rolling out a redesign of helpcurenow, and we've implemented a Twitter feed in the footer. (I'm the design & front end guy, my coworker is the scripting & backend guy).

All is well with the Twitter feed in all major browsers except internet explorer, version 8 and later.

However we have no clue why IE is not pulling the feed at all. Any hints??

/ (look in footer)

We're rolling out a redesign of helpcurenow, and we've implemented a Twitter feed in the footer. (I'm the design & front end guy, my coworker is the scripting & backend guy).

All is well with the Twitter feed in all major browsers except internet explorer, version 8 and later.

However we have no clue why IE is not pulling the feed at all. Any hints??

http://betawww.helpcurenow/ (look in footer)

Share Improve this question edited Jun 15, 2010 at 19:55 Marcel Korpel 21.8k6 gold badges62 silver badges80 bronze badges asked Jun 15, 2010 at 19:42 Joel GlovierJoel Glovier 7,68910 gold badges54 silver badges87 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Found it! The problem is with the li.innerHTML = assignment. Basically, you're feeding the Twitter script a template somewhere, which looks like

"<li class="ftr-tweet"><p>%text%</p><a href="http://twitter./%user_screen_name%/statuses/%id%" class="ftr-tweetTimestamp">%time%</a></li>"

But unfortunately, Twitter already created a <li> and only wants to get its inner HTML. What happens now is that you insert a <li> into the Twitter-created <li>... which most browsers accept, but IE8 doesn't. It simply won't accept incorrect HTML, which is of course a very noble principle for Microsoft. See http://www.theogray./blog/2009/06/internet-explorer-unknown-runtime-error.

So the solution is leaving the li out of your template. But then you won't have the ftr-tweet class anymore... So replace it with a <span> and all's well with the world.

"<span class="ftr-tweet"><p>%text%</p><a href="http://twitter./%user_screen_name%/statuses/%id%" class="ftr-tweetTimestamp">%time%</a></span>"
发布评论

评论列表(0)

  1. 暂无评论