# Ionic offline

**URL:** <https://forum.ionicframework.com/t/ionic-offline/130893>\
**Category:** ionic-v1\
**Created:** [May 20, 2018, 5:54am UTC](https://forum.ionicframework.com/t/ionic-offline/130893 "2018-05-20T05:54:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cj10](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@Cj10](https://forum.ionicframework.com/u/Cj10)\
**Post date:** [May 20, 2018, 5:54am UTC](https://forum.ionicframework.com/t/ionic-offline/130893/1 "2018-05-20T05:54:45Z")

</div>

I have an app created in Ionic and all information is currently online on a server and the app makes the request, the server returns the data, mounts the page and Ok. But it will come to a point where some of that information should be shown offline. Is it possible / feasible because of internet limitations to write some of this data online in offline storage or in a SqLite so that they can access some information?  
Or do you have ways to feed this storage or Sqlite automatically from this mysql online?

Thanks

---

<div class="post-metadata">

**Author:** ![Shualt](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/shualt/32/119563_2.png) [@Shualt](https://forum.ionicframework.com/u/Shualt)\
**Post date:** [May 22, 2018, 5:12pm UTC](https://forum.ionicframework.com/t/ionic-offline/130893/2 "2018-05-22T17:12:25Z")

</div>

hi Cj10

Exist a command that detect when the app is offline or online:  
put the code in directives

```auto
 document.addEventListener("offline", onOffline, false);
  function onOffline() {
     // Handle the offline event
  }

```

```auto
document.addEventListener("online", onOnline, false);
    function onOnline() {
        // Handle the online event
  }

```

u can put that save ur information in a array of localstorage and when the internet return if the array containts information u can save to mysql

---

<div class="post-metadata">

**Author:** ![Cj10](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@Cj10](https://forum.ionicframework.com/u/Cj10)\
**Post date:** [May 24, 2018, 3:07am UTC](https://forum.ionicframework.com/t/ionic-offline/130893/3 "2018-05-24T03:07:32Z")

</div>

Nice. Do you have any examples or tutorials that I can follow to implement this functionality?  
Thanks.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:35pm UTC](https://forum.ionicframework.com/t/ionic-offline/130893/4 "2021-07-19T21:35:07Z")

</div>

Closed on July 19, 2021, 9:35pm UTC


