I am trying to make a app which can save the web page offline for later reading. I found ASIWebPageRequest project can cache the web content. However, I have a question, if I have lots of web page, such as 100 pages, each one contains many images. Is it a good solution for it? Or this project can dynamic load content from it cache?
I am thinking another solution, but I am not sure if it’s possible and how to implement. Could you help give some suggestion?
When loading the page, the iOS parsing the http content and save all resources, such as image, css, js, to the database. When accessing it next time, it get those resource database. Is it possible?
Best Regards,
Yes it is possible.
You can do a regexp on the Content returned by a NSURLRequest and save all links and images to disk. My suggestion is, replace the path with the regexp and rename images/resources to be a md5 of their content. so if you get an image twice, it will only download once 🙂
I wrote a lot of code for this, but i cannot publish it 🙁 But it is possible and it works, takes about 100 lines.
Please +1 this if it helped you. thanks 🙂