This article mainly introduces js to determine whether the client can access the Internet in detail. Friends in need can refer to it.
The first one:
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script language="javascript" type="text/javascript"> if(!window.jQuery){ alert("能上网"); }else{ alert("不能上网"); }
The second one:
Use js to cross domain Do
$.getScript("http://api.taobao.com/apitools/ajax_props.do?act=props&cid=50000436&restBool=false", function () {
//Put Some codes that can only be done online
);
or
//Cross-domain (can cross all domain names)
$.getJSON("http:// e.hnce.com.cn/tools/ajax.aspx?jsoncallback=?", { id: 0, action: 'jobcategoryjson' }, function(json) {
alert(json[0].pid );
alert(json[0].items[0]._name);
});
Related recommendations:
What are the methods for JS to determine json
How to use JS to determine whether the current page has scroll bars
js determines whether it is PC or mobile
The above is the detailed content of Detailed explanation of js to determine whether the client can access the Internet. For more information, please follow other related articles on the PHP Chinese website!