iOS 9 content blocking: available in Pleco reader?

etm001

状元
Hi,

The title says it all. Will iOS 9 content blocking work with the APIs/framework that Pleco uses for web browsing?

Thanks!
 

mikelove

皇帝
Staff member
No, not possible at the moment - the only way an app can embed a content-blocked web browser is with the new SFSafariViewController, and that specifically *doesn't* allow for apps to customize the page content. We are planning to migrate from UIWebView to WKWebView (which is a lot faster) as soon as we drop iOS 8 support - needed to wait for 9 to move to that because the iOS 8 iteration didn't allow for loading offline data (e.g. in EPUBs) - but I don't know of any way to access content blocking in a non-system-supplied web view.

However, if a website loads awkwardly you can always tap on the glasses icon to pull it up in reading mode + skip most of the cruft. Also, assuming no major setbacks we should have split screen mode working on the latest iPads at least and that should make it very efficient to pull up words in Pleco while browsing the web with regular Safari.
 

etm001

状元
However, if a website loads awkwardly you can always tap on the glasses icon to pull it up in reading mode + skip most of the cruft.

This is exactly what I do, especially at night (because this mode has dark colors). One thing I'm curious about is how you parse web pages to extract text - have you rolled your own solution or do you utilize a 3rd party API/framework? It works well, although it does extract a bit of crud from headers/footers, navigational elements, etc. This is not a huge deal, as I can just scroll past most of it to the main body of text, but I'm wondering if the text extraction could be tweaked a bit.
 

mikelove

皇帝
Staff member
We rolled our own - pretty straightforward, few dozen lines of JavaScript. Would love to come up with a better solution for stripping text a la Reader Mode in Safari.
 

etm001

状元
Just a quick ~1 year follow up:

We are planning to migrate from UIWebView to WKWebView

Assuming this migration took place, does WKWebView now provide APIs that would allow it to take advantage of iOS native content blockers?

Thanks!
 

mikelove

皇帝
Staff member
We did indeed migrate to WKWebView, but it doesn't support native content blockers as far as we can tell; only SFSafariViewController does, and we don't have enough control over that to support reading in it.
 
Top