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

javascript - Is there a jQuery EventSource? - Stack Overflow

programmeradmin12浏览0评论

Server Sent Events seem like a prime candidate for a jQuery plug-in. Page 921 of JavaScript, the Definitive Guide shows how to use EventSource. But then page 923 says that IE uses attachEvent instead of addEventListener.

I found jQuery.EventSource on github, but there's no mention of attachEvent. It instead falls back to using $.ajax.

Q: If I'm going to use the EventSource feature of JavaScript, should I use jQuery.EventSource?

I gotta have more jQuery!

Server Sent Events seem like a prime candidate for a jQuery plug-in. Page 921 of JavaScript, the Definitive Guide shows how to use EventSource. But then page 923 says that IE uses attachEvent instead of addEventListener.

I found jQuery.EventSource on github, but there's no mention of attachEvent. It instead falls back to using $.ajax.

Q: If I'm going to use the EventSource feature of JavaScript, should I use jQuery.EventSource?

I gotta have more jQuery!

Share Improve this question edited Jan 31, 2012 at 3:28 Phillip Senn asked Jan 31, 2012 at 3:22 Phillip SennPhillip Senn 47.6k91 gold badges260 silver badges378 bronze badges 2
  • 2 There is also github.com/Yaffle/EventSource and github.com/remy/polyfills/blob/master/EventSource.js, but I'm not sure what each does over native EventSource. – Phillip Senn Commented Jan 31, 2012 at 3:31
  • upvoted for presumed cowbell reference – wvdz Commented Jun 17, 2015 at 23:06
Add a comment  | 

1 Answer 1

Reset to default 15

As of today IE9 doesn't support EventSource (Server Sent Events). In the good article by Remy Sharp, there is at the end of the article a list of polyfill solutions.

发布评论

评论列表(0)

  1. 暂无评论