Swift 3 - How to close an open webview page?

Asked

Viewed 54 times

1

in a, index.html viewcontroller am using this code to open a local html file

self.webView = WKWebView(frame: webFrame, configuration: config) self.webView?.uiDelegate = self as? WKUIDelegate self.webView?.navigationDelegate = self self.webView?.scrollView.bounces = false self.container!.addSubview(webView!) let testUrl: URL! = Bundle.main.url(forResource: "index", withExtension: "html", subdirectory: "assets") self.webView!.loadFileURL(testUrl, allowingReadAccessTo: testUrl)

debugging by safari in the Developer > Simulator menu appears the open page (index.html) It happens that every time I leave this viewControler and return is added in the menu Developer > Simulator a new page (index.html, index.html,...). I believe that are new page open in new tabs

in the function I use to exit this viewController use this code

self.webView?.removeFromSuperview() self.container.removeFromSuperview()

objects are removed but pages are not, does anyone know how to remove them?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.