Safari service worker work incorrect with custom offline page
I created a pwa version of the site with a custom offline page using the service worker. https://ohladkov.github.io/ When navigating through pages, they are added to the cache, and when they are visited again, it is shown from the cache. When you click on a link and do not connect to the Internet and this page is not cached, an offline page is displayed.
There are 2 options to refresh the page:
When the Internet appears on the offline page, a link appears to update the page.
When the Internet appears, return to any available page (home
page) and go to the desired page.
With the first option there is no problem. And with the second there is a problem in the safari. The problem occurs when:
- clicked on the link without an Internet connection and received an offline page
- The next time already with the Internet connection went on the same link and again received an offline page, although it should show an online page
Steps to reproduce the problem:
- go to the site with the Internet turned on
- turn off the Internet
- go to page1.html (an offline page is displayed)
- go back to index.html (go home link)
- turn on the internet
- go back to page1.html (an offline page is displayed, but page1.html should be displayed)
- go to page2.html - everything works correctly, the online page loads
Who faced such a problem? It seems that the safari remembers request-response bunch and return the same result, regardless of the connection to the Internet.
Code here: https://github.com/ohladkov/ohladkov.github.io/blob/master/sw.js
iPhone 8, iOS 11.3.1, null