Home  >  Q&A  >  body text

objective-c - IOS webView获取js脚本文件的url

如上图片显示,我想在webView加载这个Html文件的时候,能获取js文件的外部链接,比如:当我监控到<script src="http:///localpath/jquery-1.8.3.min.js"></script>这个地址被调用时,我替换地址调用本地脚本文件。
现在我想问:
1.这样可以实现吗?
2.我如何监控webView调用js细节,比如我再webView的代理方法里可以监控webView调用了某个URL

ringa_leeringa_lee2721 days ago615

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-18 09:47:30

    1. This can be achieved
    2. The specific principle is actually loading monitoring and dynamic replacement when loading a web page. There is currently a library that implements this functionality. The library is very old~ but you can use specific js cache or dynamic replacement

    If you have any problems during use, you can contact me~

    reply
    0
  • Cancelreply