setRoot() deletes Session Cookies

I sadly found out, that Session Cookies get deleted, if you use navCtrl.setRoot().

This is a Problem for me, because I Need them for futher XHR.
I think it makes sense the set the new Root after the Login page (where I execute an external <form> to get the Session-Cookie) to the Home Page, else you navigate with the devices back Buttons back to the Login and that feels bad (and a few other situations).

Btw will the Http Native Plugin use Session Cookies of an other Domain (not localhost:8100) to Access the same Domain?

Any Suggestion or tipps? :slight_smile:

The solution was the InAppBrowser.

  submitLoginForm() {
    var pageContent = '<html><head></head><body><form id="loginForm" action="youLoginURL" method="post">' +
      '<input type="hidden" name="username" value="' + this.email + '">' +
      '<input type="hidden" name="password" value="' + this.password + '">' +
      '</form> <script type="text/javascript">document.getElementById("loginForm").submit();</script></body></html>';
    var pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);

    var browserRef = this.inappbrowser.create(
      pageContentUrl,
      "_blank",
      "hidden=yes,location=no,clearsessioncache=yes,clearcache=yes"
    );
  }

With this, you get a Session Cookie permanently and it works with simple XMLHTttpRequests from JavaScript.
They don’t disappear after this.navCtrl.setRoot() and just work.
It’s important to send every input field, even hidden fields!

Let me know if I could help anyone :slight_smile: