我对使用IE的SignalR客户端方法感到困扰。它适用于chrome,但当我使用ie 10它不会调用我的客户端功能这里是我的代码
控制器:
public async Task<ActionResult> _Export( string columns)
{
var vmexport = new JavaScriptSerializer().Deserialize<VMEXPORT[]>(columns);
var filePath = System.Web.HttpContext.Current.Server.MapPath("~/") + "CSV\\" + AgentPrompttx + DateTime.Now.ToString("dd-MM-yyyyHHmm") + ".csv";
var replycls = await Task.Run(() => _serviceAgent.CreateCsv(arrparam));
SendNotification(CurrentMember.user_nm);
return File(filePath, "application/octet-stream", Prompttx + DateTime.Now.ToString("dd-MM-yyyyHHmm") + ".csv");
}
发送给客户的方法:
public void SendNotification(string message)
{
GlobalHost.ConnectionManager.GetHubContext<MyHub>().Clients.All.receiveNotification(CurrentMember.user_nm);
}
客户端:
$(window).load(function () {
var myHubConnection = $.connection.myHub;
myHubConnection.client.setOnline = function (usernm) {
if ($('#user_kgrid').data('kendoGrid') != undefined)
$('#user_kgrid').data('kendoGrid').tbody.find('td:contains("' + usernm + '")').eq(0).parent('tr').find('td:contains("Offline")').html('<span><i class="icon-ok-sign"></i></span> Online')
};
myHubConnection.client.receiveNotification = function (recipient) {
if (recipient == $('#usernm').text()) {
$.growl({
title: '<strong>SAVING:</strong> ',
message: '<a href=\"https://twitter.com/Mouse0270\" target=\"_self\">Link Here</a>'
}, {
type: 'info',
placement: {
from: "top",
align: "right"
},
});
}
else
return false;
};
$.connection.hub.start().done(function () {
setTimeout(function () {
$.connection.hub.start().done(function () {
$.connection.myHub.server.brodcastLogIn($('#usernm').text());
});
}, 1000);
});
});
它在Chrome上工作正常,但在IE上却没有,请你告诉我我的代码有什么问题,或者我需要改变什么?