I have a webview with a navigation toolbar that has back, rewind and forward buttons. I want to prevent the user from navigating back to the login page (there are local and a remote login URLs, but both contain "mobile_login" in the path).
I can prevent the back button from being enabled if the last url was the login page (by storing a variable for the last url), but unless I create an unlimited variable array of page history and check through it every time, if I go forward n pages and then go back n times the back button will take you back to the login page. I've tried checking btnRewind.target.URL.absoluteString but it just crashes the app.
eg:
if webView.canGoBack == true {
btnRewind.enabled = !(btnRewind.target?.URL.absoluteString.containsString("mobile_login"))!
}
I'm surprised I haven't found this question asked/answered already, I must be searching with the wrong terms
