GithubHelp home page GithubHelp logo

Comments (1)

pedant avatar pedant commented on July 21, 2024

首先表明立场,不建议在shouldOverrideUrlLoading上去做层协议来发起js调用,暂时能想到的原因有:

  • 试想一下页面端如果要任何时候发起调用,都必须"模拟"一个链接跳转事件而java端才能收到通知。这样的模拟在页面端比较耗时(我曾经做webapp时尝试过)。
  • 另外,页面端一般是同步调用执行java方法,执行完成后有时需要返回各个类型的结果,而在shouldOverrideUrlLoading中不能做到多种类型的结果的【同步】返回。
  • 还有种情况,假设页面存在一个正常链接在需要点击完成reload的同时又需要调用java方法怎么办,这两处都会执行都会跑到shouldOverrideUrlLoading中来,使其内部又掺杂业务又掺杂js调用框架,本质上更复杂难以维护。

综合上面对比下safe-java-js-webview-bridge原理就知道优势了。

欢迎探讨补充。。。

from safe-java-js-webview-bridge.

Related Issues (20)

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.