I'm building a quiz. A page is displaying a question, and when the user answers, another page is displaying the answer. When the user is on the question page, I would like in advance to cache the corresponding answer page.
So when the user answers a question, the answer's page is displayed without any loading time (as it is retrieved from the service worker and it's blazing fast).
What is the best approach to achieve this?
The solution I thought about:
On the question page, insert a hidden IFrame displaying the answer's page allowing the service worker to cache all resources (html and images). I think it's too tricky and it doesn't seem to be a common solution; can't really find other people using this trick, so I thought there must be a better way?