ios - UIWebview Does NOT complete Load page with "page NOT found" error when URL does not exist -
in iphone app i've got load mobile website webview (that contain in separate viewcontroller). , working fine.
i need exit webview when reach specific set of url's. problem of these url's not exis , therefore page not finish load (even page not found error message detect current url. hangs)
would know if have enable setting in webview allow load pages not exist (with page not found error).
or
is possible know url going load next in
func webviewdidstartload(webview: uiwebview)
override func viewdidload() { super.viewdidload() mywebview.delegate = self var returnurlappendedpaymmentlink = "www.existing_url.com" let requesturl = nsurl(string: returnurlappendedpaymmentlink) let request = nsurlrequest(url: requesturl!) mywebview.loadrequest(request) } func webviewdidfinishload(webview: uiwebview) { var currenturl = webview.request?.url?.absolutestring ?? "" if (currenturl == "www.special_url.com") { self.navigationcontroller?.popviewcontrolleranimated(true) } }
to intercept specific urls, use shouldstartloadwithrequest
delegate method of uiwebview
.
you can check url of request in method see if "special" url, handling case , return false
web-view won't load it.
Comments
Post a Comment