Socket.IO 浏览器兼容代码

if (/Firefox\/\s/.test(navigator.userAgent)){
    var socket = io.connect('127.0.0.1:8000',{transports:['xhr-polling']}); 
} 
else if (/MSIE (\d+.\d+);/.test(navigator.userAgent)){
    var socket = io.connect('127.0.0.1:8000',{transports:['jsonp-polling']}); 
} 
else { 
    var socket = io.connect('127.0.0.1:8000'); 
}
posted @ 2016-09-30 17:02  我知道你的存在  阅读(1522)  评论(0编辑  收藏  举报