WBWebViewConsole is an In-App debug console for your UIWebView && WKWebView
WBWebViewConsole is available on CocoaPods. Just add the following to your project Podfile:
pod 'WBWebViewConsole', '~> 1.0'
- Make your own
UIWebView
orWKWebView
subclass, and implements all methods inWBWebView
protocol - Setup
JSBridge
andconsole
when WebView inits - If you are using
UIWebView
, inject userScript as early as possible after page loading. Otherwise, just useWKUserScript
to implement. - In
UIWebView
'swebView:shouldStartLoadWithRequest:navigationType
orWKWebView
'swebView:decidePolicyForNavigationAction:decisionHandler
- Pass the request to
-[JSBridge handleWebViewRequest:]
and use the return value to decide wether the navigation should start
- Pass the request to
- Use
WBWebViewConsole
to manage all messagesaddMessage: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 aWBWebViewConsole
initWithConsole:
- designated initializer for this class
setInitialCommand:
- set the placeholder command
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
.