History Sniffing via SW and Iframe
To test this attack, Follow the below steps
- Make sure you are offline
- Enter a URL of a site that has SW (with offline support) that has not been visited before (for example, https://love2dev.com)
- Click button 'Add Frame' to set it as Frame's URL
- At this point, no alert should appear. Connect to internet again and visitng the same URL to make sure its SW is registered
- Repeat the steps (1-3) again. The onload event would be activated and an alert box is shown
- This test could be repeated for a URL that doesn't register a SW. The alert would not be shoen in offline mode even if the page was visited earlier