我正在使用这个 polyfill 使服务器端事件(EventSource)与 IE 一起工作 - https://github.com/Yaffle/EventSource
它工作得很好,除了我无法检查来源,就像本教程推荐的那样(出于安全目的)http://www.html5rocks.com/en/tutorials/eventsource/basics/
这是来自 html5rocks 的代码
source.addEventListener('message', function(e) {
if (e.origin != 'http://example.com') {
alert('Origin was not http://example.com');
return;
}
...
}, false);
有没有办法设置和检查原点,让它与 IE 一起工作?