When working with webviews in iOS, there are two key methods to be aware of when it comes to injecting CSS:
didStartProvisionalNavigation. Understanding the difference between these two methods is important for ensuring that your webview-based app behaves as expected.
On the other hand, the
In general, it is best practice to inject CSS into a webview using the
didCommit method, as this ensures that your styles will be applied correctly and will not be overwritten by subsequent page loads. However, there may be specific use cases where injecting CSS using the
didStartProvisionalNavigation method is necessary, such as when you need to apply styles to a page before it has fully loaded.
In summary, it is important to understand the difference between
didStartProvisionalNavigation when working with webviews in iOS, and to choose the appropriate method for injecting CSS based on your specific use case. Using
didCommit method is the best practice, as it ensure that your styles will be applied correctly and will not be overwritten by subsequent page loads.
BTW, WebViewGold for iOS uses
didCommit method for Custom CSS Injection.