![]() ![]() title is another observable property which we’ll use to get the title of the currently loaded page.Īdd the following to viewDidLoad() right underneath the other calls to addObserver() In the previous article we looked at some observable properties of WKWebView like loading and estimatedProgress. It would be useful to have the page title showing as an indicator to where the user is on the website. Run the app and any tap on an external link will open up Safari which will load the page. Otherwise the page loads as usual and renders in the web view. If both conditions are met, then the URL is opened by the device’s browser (Safari) and WKNavigationActionPolicy.Cancel stops the process. ![]() We then check the request url to determine whether it is an external link. We only want to interrupt external links that have been initiated by a user and so we check for the navigationType. In the above code, we use two of its properties, navigationType and request. One of its parameters is an WKNavigationAction object which contains information that can help you decide whether to continue page load or not. The above is a WKNavigationDelegate protocol method that gets called several times during the page load. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |