###実現したいこと
新たにサイトをタブを開いた際に、戻るボタンを配置を実装して元のサイトに戻りたい
以下のコードでtarget="_blank"でリンク先へ飛べるよう実装しています。
リンク先で戻るボタンがない場合、元のサイトに戻れないため、リンク先で戻るボタンを必要としています。
swift
1func webView(_ webView: WKWebView, 2 createWebViewWith configuration: WKWebViewConfiguration, 3 for navigationAction: WKNavigationAction, 4 windowFeatures: WKWindowFeatures) -> WKWebView? 5 { 6 7 if navigationAction.targetFrame?.isMainFrame != true { 8 let newWebView = WKWebView(frame: webView.frame, 9 configuration: configuration) 10 newWebView.load(navigationAction.request) 11 newWebView.uiDelegate = self 12 webView.superview?.addSubview(newWebView) 13 return newWebView 14 } 15 16 return nil 17 } 18 19 func webViewDidClose(_ webView: WKWebView) { 20 webView.removeFromSuperview() 21 }
お分かりの方、ぜひ宜しくお願いします。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/04/28 07:20 編集
2020/04/28 08:06