ioBroker/ioBroker.lovelace

unreliable refresh if opened on iPhone as shortcut to Homescreen

AleXburnA opened this issue · 1 comments

first, thanks for the port of LoveLace! I am using it since the first release.

Unfortunately, I am experiencing a strange issue on iPhones for about a year: Since there is no native app, I am using the "to homescreen" feature of Safari to add a shortcut to LoveLace.

When I open the shortcut, there is a 80% chance that it shows old values and buttons etc. are not working. When I force-close the app and reopen it, everything works again. In the remaining 20% of the cases, it opens, refreshes itself and everything works fine.

This is only a issue on iPhones, it works fine on the Android phone of my wife (Galaxy S20)

Could you maybe implement a "Cache-Control" header to enforce the iphone to refresh the page when its opened?

EDIT: I managed to hack the "Cache-control: no-cache, no-store, must-revalidate" header into the server.js, but it doesn't fix the issue. The iPhone doesn't refresh the page when the "app" is opened.

EDIT2: if I explicitly set the URL ipaddress:8091/lovelace/default_view in the shortcut to homescreen, the iPhone behaves differently: now LoveLace is refreshed every time I open it and it seems to work stably.
However, now it doesn't open as a PWA, it just opens a new tab in Safari and I have the address bar at the bottom.

Unfortunately, I understand far too little about web development to judge what is going differently here. For me it's a workaround for now, even if the address bar at the bottom is annoying. Better this way than no function at all.

But with any luck, these tips will help you fix the problem?

EDIT3: With this workaround, I get greeted by a "you are about to give http://ipaddress:8091/ access to your ioBroker instance" in 50% of the time I open the page. I would then need to authenticate but authentication is off. So I don't know what to enter here... In the other 50% of the time, it works great.

EDIT4:: I managed to figure out the default credentials of iobroker (admin / iobroker) and I entered it. It worked and now BOTH ways seem to work great. At least I am unable to reproduce the issue anymore. So it seems this has fixed the whole problem. I will watch this and get back to you.

What remains strange is: why did this username/password query come up at all and why did it only come up in 50% of the time. And why did it have no effect on Android?

Thanks in advance!
Alex

chah90 commented

Hi,
I had similar issues and could solve it by disabling mobile Safari’s NSURLSession Web Socket in the Settings (Settings App -> Safari -> Advanced -> Experimental Features; hope the translations are correct as I’m using my phone in German).

But be aware: The setting resets on every iOS update. And of course it’s only a workaround as the WebSocket could become the standard (without the chance of disabling it) by Apple with every update.