Git Product home page Git Product logo

wbwebviewconsole's Introduction

WBWebViewConsole

WBWebViewConsole is an In-App debug console for your UIWebView && WKWebView

WBWebViewConsole

Installation

WBWebViewConsole is available on CocoaPods. Just add the following to your project Podfile:

pod 'WBWebViewConsole', '~> 1.0' 

Bugs are first fixed in master and then made available via a designated release. If you tend to live on the bleeding edge, you can use WBWebViewConsole from master with the following Podfile entry:

pod 'WBWebViewConsole', :git => 'https://github.com/Naituw/WBWebViewConsole.git'

Setup

  • Make your own UIWebView or WKWebView subclass, and implements all methods in WBWebView protocol
  • Setup JSBridge and console when WebView inits
  • If you are using UIWebView, inject userScript as early as possible after page loading. Otherwise, just use WKUserScript to implement.
  • In UIWebView's webView:shouldStartLoadWithRequest:navigationType or WKWebView's webView:decidePolicyForNavigationAction:decisionHandler
    • Pass the request to -[JSBridge handleWebViewRequest:] and use the return value to decide wether the navigation should start

Usage

  • Use WBWebViewConsole to manage all messages
    • addMessage:type:level:source:
      • add message for specific type, level and source
    • clearMessage
      • empty all messages
    • sendMessage
      • input (eval) script
    • storeCurrentSelectedElementToJavaScriptVariable:completion:
      • save current selected element to a js variable
  • Use WBWebDebugConsoleViewController to display a WBWebViewConsole
    • initWithConsole:
      • designated initializer for this class
    • setInitialCommand:
      • set the placeholder command

License

WBWebViewConsole is BSD-licensed. see the LICENSE file.

The files in the /Examples directory are licensed under a separate license as specified in Examples/README.md.

wbwebviewconsole's People

Contributors

naituw avatar

Watchers

Fred Chen avatar James Cloos 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.