ios safari usually fails to execute first http request after wake up - ios

I have developed a web app using Angularjs. This app is intended to be used by company employees that have an iPad.
The application works great on Chrome, but Safari is causing problems. iOS Safari usually fails to execute first http request after wake up. If a user tries to navigate within the app after a wake up, the http request fails, the application shows the error to the user, then the user needs to refresh the page one or more times to get it working again.
Is there something I can do to workaround this problem other than recommend users to use Chrome instead of Safari?
EDIT: thanks to a friend that has a Mac I got the exact error message:
Failed to load resource: The network connection was lost

Related

Progressive Web App on iOS 12.2 stuck in offline page

I installed a custom progressive web app via safari and its "Add to Home Screen" option.
If I navigate to a specific page without an internet connection I get the native offline page of safari, as expected. The page shows the following message:
Safari cannot open the page because your iPhone is not connected to the Internet.
If I turn the internet connection on again, the PWA still shows the native safari offline page, giving the user no possibility to reload the page or navigate to another page.
To put in a nutshell, if I access my PWA without an internet connection once, the PWA shows native offline page of safari forever.
Is this the expected behavior of progressive web applications on iOS 12.2?
My service worker looks like this:
self.addEventListener('fetch', (evt) => {
return;
});
Even if I serve a custom offline page as described in this article, the PWA is still stuck on the offline page, if I turn on my internet connection again.
That is the expected behaviour when there is no default offline fallback page. Instead, I'd recommend creating a proper offline fallback page. There's a complete sample you can copy/paste in Create an offline fallback page.
It includes the service worker code you need, and a basic offline page that will attempt to reload the page once the network or server is back. You can see a working demo at https://basic-pwa.glitch.me/

Handling Custom URL Application Start in ios

We have link functionality in our web application that when clicked, browses to a page on our server that performs the following:
Tries to open the custom url to our ios application
If this fails, it redirects the user to our ios app store to download the app.
This actually all works perfectly well.
However, it creates a weird corner case, where after a user has done this and finished, if they come back sometime later and open their safari on the same phone, if our web link is still the active tab, it will redirect them again to our application.
The cause of this is fairly obvious, but we are struggling to come up with a solution for it. Is there any known to rectify this behavior, either through a different mechanism then I described for opening the application or through somehow killing the page simultaneously?

How did a Captive Portal force to open a browser

I've setup a Captive Portal with dd-wrt, wifidog, authpuppy and some plugins from authpuppy as well as my own web app.
I am wondering what's the exact thing that will trigger a
browser on the client device to popup?
Is the popup browser from iPhone/iPad a regular browser mode?
It seems some JavaScript will fail on the browser mode, like the shake.js,
event though iOS Safari version is > 4.2.1 from https://github.com/alexgibson/shake.js/
P.S.:
I've done the research like
http://en.wikipedia.org/wiki/Captive_portal
https://personaltelco.net/wiki/CaptivePortal
they don't talk much about the popup browser.
Could anyone help?
If you will try to see the network statistics [request/response] you will find out that devices like ios and android both of them continuously hits some particular urls [in case of android it is www.google.com/generate_204 , don't remember exact url for ios]. These url are generated by system internally. These pings let their server know about various details. So as soon as ios gets connected with a captive portal it tries to hit the system generated url, failing to which it understands that this is packet level protected network and open the browser.
Hope this helps.

iOS 6.1.2 forever caching redirect content

I've got (actually my employer has) a mobile website that enables Safari integration (for iPhones and iPads) - meaning that customers can bookmark it to their home screen and then it would behave as a standalone web app (no address bar, custom icon, start-up image etc).
It works all right except that one week ago (coincidentally soon after apple has released iOS 6.1.2) some of our customers (6 of them initially) complained that they no longer get the normal content but a '404 page' of a public wifi provider (The Cloud owned by Sky here in the UK). After a bit of investigation we've figured that at some point those customers connected to the Cloud wifi without actually logging in (it's one of those providers that would redirect you to a login page to enter your credentials, after which you can carry on browsing). The thing is that even after switching back to their private wifi or mobile data connection the application would display the Cloud's page.
This only happens (as far as I can tell) when the application is launched via the bookmark (I couldn't see this behavior when using it from safari).
What happens is that the customers would connect to the cloud wifi (without logging in), they would open the application at which point the router will issue a redirect response to their login page; the application would cache the login page and it will always display it whenever using the bookmark again. (I've performed a capture when this happens and there are no requests being made at start-up whatsoever).
Even weirder, in this situation, if removing the existing bookmark and adding a new one will show you the same cached page (with the whole operation being performed away from the Cloud). We've fixed this by adding a unique identifier to the URL each time we hit the bookmark screen (this indicates that the web apps' sandboxes are linked to the url, which is to be expected).
What we're trying to achieve is to have the application properly recovering after the customer has moved away from the Cloud. But there doesn't seem to be a straight forward way to do this.
Furthermore there's a level of inconsistency in all of this - most of the times when the flow is performed I will see a 404 page (a custom 404 page https://service.thecloud.net/service-platform), but sometimes I would be properly redirected to the login page, in which case the application would not break.
My assumption is that there is a weird race condition in the standalone web app application model causing the browser not to properly handle redirects (and actually caching 404 pages). I've raised a support incident with Apple (which eventually turned into a bug report) but it might take a while and I'm trying my best to figure out a workaround.
Any ideas, maybe someone has seen this before?
The issue is aggravated by the fact that I need to have a 5 minutes walk ever time I'm testing any fixes; I've tried creating simple test forms, but I wasn't able to reproduce the issue, where as with the full app I can do it pretty much every time.
Here's a summary of the steps to reproduce:
Via private wifi (or mobile data connection) add a bookmark to a website (I've managed to reproduce it with quite a couple of apps that support safari integration as described above)
Open the application to review the normal content
Connect to a Cloud hotspot and open the application from the bookmark (open-close it for a couple of times if you don't get the 404 right away)
Connect to the private wifi (or mobile data connection) and open the application via the bookmark -> you'll see the same 404 page again
In the end the fix was to add a unique query string parameter with the initial page request (pretty easy with the setup we already had, via the launcher page). I've filed a bug report with Apple which they've acknowledged by linking it to a previous item. Here's a post on the topic:
http://blog.onos.ro/ios-6.1.2-caching-issue

iPad Safari reloads main page constantly

Our Webapp site has strange problem where we get occasionally huge number of page reloads from Apple iPad Safari.
What happens is that Safari opens keep alive HTTP 1.1 connection to our server and issue streams of GETs to it. The requests can arrive only tens of milliseconds from each other and it seems Safari is reloading the page as soon as it gets response to previous request. After sending 4-5 requests, Safari closes socket, opens new and same thing repeats for several minutes until it suddenly stops.
Things checked
Happens only with main page root url /
Page has no window.location.reload call on load that could cause this
Confirmed with tcpdump and wireshark that problem is real and happens between iPad device and our server. (i.e. not problem with haproxy, our servers or buggy logging)
Problem seems to be mainly with iOS 4.3.3
I can not ask the users and we have not repeated this locally with testing devices
All problem requests come from single IP that seems like VPN gateway of a school but from different random users (based on cookies same users may use webapp days successfully until problem repeats)
Has anyone idea what might be happening here?
Broken proxy somehwere?
iOS HomeScreen webapp bookmark gone haywire?
DoS attempt, though lame one
People turn zombies while using our webapp and instead of Brainsss they crave Reloadss?

Resources