在javascript中检查互联网连接 [英] Checking internet connection in javascript

查看:119
本文介绍了在javascript中检查互联网连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在堆栈溢出中看到了很多关于这个主题的问题,但只有一个代码帮助我这样做,代码在检查互联网连接是否存在Javascript?由于我没有50个声誉,我无法在帖子下通过morespace54发表评论

I have seen many questions about this topic in stack overflow but only one code helped me to do it and that code is in Check if Internet Connection Exists with Javascript? As I don't have 50 reputations I couldn't comment under the post by morespace54

<script>
function doConnectFunction() {
// Grab the GOOGLE CMD
}
function doNotConnectFunction() {
// Grab the LOCAL JQ
}

var i = new Image();
i.onload = doConnectFunction;
i.onerror = doNotConnectFunction;
// CHANGE IMAGE URL TO ANY IMAGE YOU KNOW IS LIVE
i.src = 'http://gfx2.hotmail.com/mail/uxp/w4/m4/pr014/h/s7.png?d=' + escape(Date());
// escape(Date()) is necessary to override possibility of image coming from cache
</script>

所以我怀疑是使用此链接有什么问题 http://gfx2.hotmail.com/mail/uxp/w4/m4/pr014/ h / s7.png 我是否必须担心版权问题如果是,那么任何人都可以帮助我找到一个没有任何版权问题的链接

So my doubt is "Is there any problem in using this link http://gfx2.hotmail.com/mail/uxp/w4/m4/pr014/h/s7.png Do I have to worry about copyright issues If yes then can anyone help me with a link that doesn't have any copyright issues"

推荐答案

只要您不在商业上使用它,您就可以使用该图像。

You can use that image for whatever, as long as you don't use it commercially.

这篇关于在javascript中检查互联网连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆