Comments (1)
首先表明立场,不建议在shouldOverrideUrlLoading上去做层协议来发起js调用,暂时能想到的原因有:
- 试想一下页面端如果要任何时候发起调用,都必须"模拟"一个链接跳转事件而java端才能收到通知。这样的模拟在页面端比较耗时(我曾经做webapp时尝试过)。
- 另外,页面端一般是同步调用执行java方法,执行完成后有时需要返回各个类型的结果,而在shouldOverrideUrlLoading中不能做到多种类型的结果的【同步】返回。
- 还有种情况,假设页面存在一个正常链接在需要点击完成reload的同时又需要调用java方法怎么办,这两处都会执行都会跑到shouldOverrideUrlLoading中来,使其内部又掺杂业务又掺杂js调用框架,本质上更复杂难以维护。
综合上面对比下safe-java-js-webview-bridge原理就知道优势了。
欢迎探讨补充。。。
from safe-java-js-webview-bridge.
Related Issues (20)
- 这个在iOS适用么? HOT 1
- JsCallback.apply(String对象)出错
- 我把你的JsCallJava的代码改了一下,用起来会更加灵活:(你可以参考一下)
- 我把你的JsCallJava.java修改了一下,这样使用起来更加灵活:(你可以参考一下) HOT 1
- 参数长度有限制,太长会报错
- 文章地址域名过期了! HOT 1
- history.back()失效 HOT 2
- import error HOT 1
- 动态注入的js内容怎么查看? HOT 1
- Java代码中要打开Activity,怎么实现 HOT 1
- js异步调用native代码时,如果回调的参数长度大于4000,则无法回调。
- 这个能否解决4.2以下,js注入漏洞问题吗? HOT 2
- WebView默认接口searchBoxJavaBridge_依然存在js注入漏洞
- 注册给InjectedChromeClient的JAVA类接口不支持注册多个类吗
- Android如何调用js呢? HOT 1
- 请教个问题 HOT 1
- JS怎么传方法给JAVA进行执行 HOT 1
- 很多机型上注入不成功 HOT 10
- 请问pendant如何传递JSONArray呢 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safe-java-js-webview-bridge.