You don't even need the service worker: just use preload hints for the related content and, if you're really convinced you need to, fetch the content so you can replace the page on a click.
That's usually a waste of time, however, compared to making sure your site is cache-friendly. As most projects have discovered, there are a lot of edge cases for making a JavaScript solution as fast or robust as the built-in browser behaviour.