Detect when `history.back()` has been called

We have a PWA that has a button that calls `history.back()`. If I'm already at the root URL `history.back()` doesn't do anything in `WKWebView`, but I also don't get notified either by any of the `WKNavigationDelegate` callbacks.


So is there a way to get notified if a website has called `history.back()`?


STEPS TO REPRODUCE

Initialize `WKWebView` and open my sample URL: https://martindinh.de/apple.html and click the "Go back" button. WKWebView will just stay on the same page without notifying the webview.


This is a simple Playground setup:

//: A UIKit based Playground for presenting user interface

import UIKit
import PlaygroundSupport
import WebKit

class MyViewController : UIViewController {
let webview: WKWebView = .init()

override func loadView() {
let view = UIView()
view.backgroundColor = .white

webview.frame = CGRect(origin: .zero, size: CGSize(width: 300, height: 500))
webview.load(URLRequest(url: URL(string: "https://martindinh.de/apple.html")!))
view.addSubview(webview)
self.view = view
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
Detect when `history.back()` has been called
 
 
Q