I am trying to download a online page and override css with my custom css. However I couldn't have success.
I did the following steps:
- Download Html string from an online page
- Added
"<link rel="stylesheet" type="text/css" href="styles.css">"to the page Html head. This styles.css contains a custom font and anothers css rules. - Loaded this new Html string to WKWebView with
webView.loadHTMLString(html, baseURL: Bundle.main.bundleURL)
Another option would be just download the page and override the css with a style tag between the head tag, however I need to add a custom @font-face from a font in my project resources.
Any ideas how can I accomplish this? If I set Bundle.main.bundleURL as my baseURL resources from the online page don't download. If I set nil as my baseURL I can't access my custom font...