检查服务器是否来自 Microsoft Edge 运行
Check if server is running from Microsoft Edge
我正在使用以下代码检查我的服务器是否 运行ning:
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
function checkServerStatus() {
var img = document.createElement('img');
img.onload = function() {
alert('success');
};
img.onerror = function() {
alert('error');
};
img.src = 'http://127.0.0.1:12345/images/test.png';
}
$(checkServerStatus);
</script>
</head>
当我 运行 此代码时我的服务器 运行ning,Chrome,FireFox 和 IE10 输出 "success" 而 MS Edge "error"。如何让 Edge 像其他服务器一样检测 运行ning 服务器?
不要使用 Jquery。 :)
也许尝试使用专注于执行 XHR 请求的库:
我正在使用以下代码检查我的服务器是否 运行ning:
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
function checkServerStatus() {
var img = document.createElement('img');
img.onload = function() {
alert('success');
};
img.onerror = function() {
alert('error');
};
img.src = 'http://127.0.0.1:12345/images/test.png';
}
$(checkServerStatus);
</script>
</head>
当我 运行 此代码时我的服务器 运行ning,Chrome,FireFox 和 IE10 输出 "success" 而 MS Edge "error"。如何让 Edge 像其他服务器一样检测 运行ning 服务器?
不要使用 Jquery。 :) 也许尝试使用专注于执行 XHR 请求的库: