Get the latest tech news
Creating a Safari webarchive from the command line
We can use the `createWebArchiveData` method on `WKWebView` to write a Swift script that creates Safari webarchive files.
I already have tools to take screenshots, and I love them as a way to take quick snapshots and skim the history of a site, but bitmap images aren’t a great archival representation of a website. If there’s some error getting the page – say, my Internet connection is down or the remote server doesn’t respond – the WKWebView will still complete loading and set isLoading = false. I saw a lot of different failures when archiving such a wide variety of URLs, including esoteric HTTP status codes, expired TLS certificates, and a couple of redirect loops.
Or read this on Hacker News