How to navigate main view out and come back?

Hello community. I hope you can help me to save a tons of time making this case work:
My ionic app need to navigate the main view to external website, and come back to the same place.

  1. User navigates to some page in my app: /somepage
  2. User taps on button to go out
  3. My app navigates main view to external website by doing this:
    window.location.href = “https://external.website.com?returnUrl={{returnUrl}}”;
  4. User does business in there and selects to come back.
  5. External website does exactly same thing:
    window.location.href = “{{returnUrl}}”;

How to form returnURL to make it work on both iOS and Android?
Any configuration I need to set?

I try to use ‘http://localhost/somepage’ now, but when (5) is happening, I see white screen. :-/

Any ideas?
Thanks.