开发者

Webbrowser control , Detect internet connection

Here is my code scenario, I display html page in webbrowser control. The content will be loaded from some RSS url dynamically (used JQuery to load the content from URL) and displayed in WB. My problem is, i have to check for the "Internet Connectivity" when a loop is completed by scrolling text. I tried using "navigator.onLine", which is working well in html page but not working when loade开发者_开发问答d into the Web browser control, it returned "true" even internet disconnected.


The jQuery ajax method lets you define an error callback, which should get hit if the user has dropped his connection (or for other reasons)...

$.ajax({
  url: "test.html",
  cache: false,
  success: function(html){
    $("#results").append(html);
  },
  error: function(XMLHttpRequest, textStatus, errorThrown){
    alert("oh crap, an error: " + textStatus);
  }
});

For more info: http://api.jquery.com/jQuery.ajax/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜