简体   繁体   English

navigator.sendBeacon 在 Internet Explorer 浏览器中不起作用

[英]navigator.sendBeacon not working in internet explore browser

i have write form unload event inside proxy code is not working in internet explore browser.我在代理代码中编写了表单卸载事件在 Internet Explorer 浏览器中不起作用。

Example:例子:

$(window).unload(function () { $(窗口).unload(函数(){
$.ajax({ type: 'POST', url: 'WebAPI/api/Values/Get?id=1', contentType: "application/json; charset=utf-8", dataType: 'json', async: true, //blocks window close success: function () { alert('sucess'); }, error: function () { alert('error'); } }); $.ajax({ type: 'POST', url: 'WebAPI/api/Values/Get?id=1', contentType: "application/json; charset=utf-8", dataType: 'json', async: true , //blocks window 关闭成功:function () { alert('success'); }, error: function () { alert('error');}}
}); });

Internet Explorer is an obsolete browser. Internet Explorer 是一个过时的浏览器。 It doesn't have a lot of modern web features, including the beacon API ( caniuse ).它没有很多现代 web 功能,包括信标 API ( caniuse )。 You could feature-detect the beacon API and fall back to XMLHttpRequest .您可以对信标进行功能检测 API 并回XMLHttpRequest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM