Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion iOS/Article/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,17 @@ private extension WebViewController {
// try? html.write(to: fileURL, atomically: true, encoding: .utf8)
// print("article.html written to \(fileURL.path)")

webView.loadHTMLString(html, baseURL: ArticleRenderer.page.baseURL)
webView.loadHTMLString(html, baseURL: loadBaseURL(for: rendering.baseURL))
}

private func loadBaseURL(for renderingBaseURL: String) -> URL {
if let url = URL(string: renderingBaseURL),
let scheme = url.scheme?.lowercased(),
scheme == "http" || scheme == "https" {
return url
}

return URL(string: "https://netnewswire.com/")!
}

func finalScrollPosition(scrollingUp: Bool) -> CGFloat {
Expand Down
5 changes: 0 additions & 5 deletions iOS/Resources/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
<style>
[[style]]
</style>
<script src="main.js"></script>
<script src="main_ios.js"></script>
<script src="newsfoot.js" async="async"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.scrollTo(0, [[windowScrollY]]);
processPage();
})
</script>
<base href="[[baseURL]]">
Expand All @@ -20,4 +16,3 @@
[[body]]
</body>
</html>