In order to reduce memory consumption I am investigating using a service like Readability too parse out images etc. from a web view that im showing from within my app. Before I go down the path of using and coding their API I was wondering if there is a way to simply inject their bookmarklet code into the webview. For example, the bookmarklet code they provide when pasted into the address bar after your page has loaded will call their code and render the page in the current path sans images and ads etc. The code you paste in is:
So I tried this by using stringByEvalutingJavascriptFromString and inserting the above code AFTER the URL has been passed to the web view but it didnt work. So before I go off down this path is something like this possible anyway?
Cheers.
Code:
javascript:(%28function%28%29%7Bwindow.baseUrl%3D%27https%3A//www.readability.com%27%3Bwindow.readabilityToken%3D%27%27%3Bvar%20s%3Ddocument.createElement%28%27script%27%29%3Bs.setAttribute%28%27type%27%2C%27text/javascript%27%29%3Bs.setAttribute%28%27charset%27%2C%27UTF-8%27%29%3Bs.setAttribute%28%27src%27%2CbaseUrl%2B%27/bookmarklet/read.js%27%29%3Bdocument.documentElement.appendChild%28s%29%3B%7D%29%28%29)
So I tried this by using stringByEvalutingJavascriptFromString and inserting the above code AFTER the URL has been passed to the web view but it didnt work. So before I go off down this path is something like this possible anyway?
Cheers.