Coder Social home page Coder Social logo

rxjavascriptdemo's Introduction

RXJavaScriptDemo

iOS app的webView(WKWebView) 与 js 交互

简单易懂, 包 活学活用哦!:sweat_smile: #import<JavaScriptCore/JavaScriptCore.h>

<html>
    <head>
        <script> var message = "您获取的字符串为nil,哈哈";</script>
        <title>iOS 拦截js function</title>
        <script type="text/javascript">
            function share(var varCharInfo) {
                //其实iOS已经拦截,就不会走下面的alert
                alert("该提示框是通过 onload 事件调用的。" + varCharInfo)
            }
        </script>
    </head>

    <body>
        <br><br><br><br><br><br>
        <button onclick="share(message)"> 调用js方法 </button>
    </body>
</html>
<html>
    <head>
        <script> var message = "iOS 往html里注入js,再去截取方法的调用";</script>
        <title>iOS 拦截js function</title>
        <!-- 这里是没有js方法的-->
        <!-- 需要app 去注入-->
    </head>

    <body>
        <br><br><br><br><br><br>
        <button onclick="share(message)"> 调用js方法 </button>
    </body>
</html>

界面

srxboys_JS

UIWebView 在html跳转的时候 注入JS

如果你有想说的可以 issues I

😅😅😅😅😅

表情网站

rxjavascriptdemo's People

Contributors

srxboys avatar

Stargazers

 avatar

Watchers

 avatar  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.