Quantcast
Viewing all articles
Browse latest Browse all 229967

Can't get cordova network plugin to work

After spending 2 hrs, nothing worked for me. I have installed cordova network plugin, also checked my androidmanifest.xml file everything was as suggested by other users. What worked for, i am posting here

1) add below code to index.html

<script>
  window.addEventListener("online", function(e) {
    window.location = "#/app/home";
  }, false);

  window.addEventListener("offline", function(e) {
    window.location = "#/app/offline";
  }, false);
</script>

In offline template i am simply showing "No internet connection" mesage. As soon as you go online, it will open app home page. and when you go offline it opens offline page.


Viewing all articles
Browse latest Browse all 229967

Trending Articles