js 判断浏览器是否使用外网

2018-09-12  本文已影响0人  多多VS串串
<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to see if the browser is online.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction()
{
var x=navigator.onLine;
document.getElementById("demo").innerHTML=x;
}
</script>

</body>
</html>

点击Try it true 是用外网 false是内网

上一篇 下一篇

猜你喜欢

热点阅读