Git Product home page Git Product logo

imywebloader's Introduction

IMYWebLoader

支持对 UIWebView/WKWebView 的资源, 进行 预加载、缓存、拦截 等操作 ... Orz

屁话

UIWebView 缓存控制这块本身很弱,几乎无法用系统API 来完成我们的扩展,于是大家找到了 NSURLProtcol 来进行缓存或者拦截的操作, 总体来说还是满足了大家的需求

iOS8 除了WKWebView 之后更是连 NSURLProtocol 都不支持了,还好 WebKit 是开源的,大家通过搜索发现了 通过注册 CustomScheme,来拦截相应scheme的请求,于是大家进行了 http、https 的拦截

但是由于 WebKit 源码的限制,request body 永远都没法互相传递,

通过大量尝试,使用 fishhook,hook c++虚函数,均已失败告终 最终放弃了在 Native 层的拦截

突然有一天...

突然想到 前端的 post body 请求,大都都是通过 XMLHttpRequest 来请求的,为何我不能在 JS 层去 hook 呢? (还在使用 from 表单的,就让它去屎吧)

hook-ajax 可能支持的没那么全,遇到问题可以帮忙改改,然后提个 pull request (一般的AJAX请求 肯定都是没问题的啦)

懒得写 readme ... 了

功能

  • 支持对 UIWebView/WKWebView 的数据缓存
  • 支持 WKWebView 带 request body 的 AJAX 请求
  • 支持断网后阅读
  • 支持预加载方法,直接解析 html,提前下载其中的静态资源
  • 支持功能实现替换,没写死,都使用协议编程
  • ...

参考

imywebloader's People

Contributors

li6185377 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.