All Projects → lovesunstar → WKBridge

lovesunstar / WKBridge

Licence: MIT license
Bridge for WKWebView and JavaScript

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to WKBridge

QuickWebKit
A great & strong plugin based WebViewController. 一款基于插件的 WebView 视图控制器,您可以基于它设计您的浏览器插件,然后像积木一样来组装它们。
Stars: ✭ 29 (-58.57%)
Mutual labels:  wkwebview, jsbridge
AppHostExample
a web-based project embeded AppHost
Stars: ✭ 16 (-77.14%)
Mutual labels:  wkwebview, jsbridge
Youtubeplayerview
Helper library for iOS developers that want to embed YouTube videos in their iOS apps with the iframe player API. 📹
Stars: ✭ 72 (+2.86%)
Mutual labels:  wkwebview
Vue-JsBridge
JsBridge for Vue
Stars: ✭ 15 (-78.57%)
Mutual labels:  jsbridge
Swiftui Webview
A SwiftUI component to use WKWebView
Stars: ✭ 158 (+125.71%)
Mutual labels:  wkwebview
Flutter browser app
A Full-Featured Mobile Browser App (such as the Google Chrome mobile browser) created using Flutter and the features offered by the flutter_inappwebview plugin.
Stars: ✭ 85 (+21.43%)
Mutual labels:  wkwebview
Wkcookiewebview
WKWebView with cookie sharing support
Stars: ✭ 171 (+144.29%)
Mutual labels:  wkwebview
Hybridpagekit
A high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App.
Stars: ✭ 1,101 (+1472.86%)
Mutual labels:  wkwebview
vue-js-bridge
vue-js-bridge for Vue.js
Stars: ✭ 41 (-41.43%)
Mutual labels:  jsbridge
Applemusicultra
Music Client for macOS. Upgrade your music experience with themes, styles, custom scripting and more. Uses WebKit and JavaScript.
Stars: ✭ 155 (+121.43%)
Mutual labels:  wkwebview
Wkwebviewextension
An extension for WKWebView. Providing menuItems delete 、support protocol 、clear cache of iOS8 and so on.
Stars: ✭ 182 (+160%)
Mutual labels:  wkwebview
Flwebview
WKWebView with UIWebView fallback for iOS.
Stars: ✭ 145 (+107.14%)
Mutual labels:  wkwebview
Mybrowser
我的浏览器,基于WKWebView实现的一个iOS浏览器,实现了无图模式、广告拦截、多窗口、扫描二维码、收藏夹/历史、无痕浏览、夜间模式等功能...
Stars: ✭ 127 (+81.43%)
Mutual labels:  wkwebview
Wkwebviewwithurlprotocol
WKWebView With URLProtocol
Stars: ✭ 174 (+148.57%)
Mutual labels:  wkwebview
Flutter inappwebview
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Stars: ✭ 1,259 (+1698.57%)
Mutual labels:  wkwebview
JsBridge-WebViewJavascriptBridge-Sample
iOS JsBridge Solution by WebViewJavascriptBridge
Stars: ✭ 16 (-77.14%)
Mutual labels:  jsbridge
Reusablenestingscrollview
An scrollView handler for UIScrollView & WKWebView and other scrollViews. Providing scrollview`s subViews reusable.
Stars: ✭ 61 (-12.86%)
Mutual labels:  wkwebview
Lcwebview
www.strictfrog.com
Stars: ✭ 144 (+105.71%)
Mutual labels:  wkwebview
Pawebview
An component WebView for iOS base on WKWebView
Stars: ✭ 169 (+141.43%)
Mutual labels:  wkwebview
HTMLWithImagesToPDF
Generate a PDF from an HTML file containing images (iOS).
Stars: ✭ 38 (-45.71%)
Mutual labels:  wkwebview

WKBridge

CI Status Version License Platform

WKScriptMessageHandler greatly simplifies the message handler from javascript running in a webpage. WKScript provides a more efficiently way for both sending and receiving messages through WKScriptMessageHandler.

Features

  • Send / Receive Messages
  • Bind Events In JavaScript
  • Callback Event

Usage

Native Handle Event

webView.bridge.register({ (parameters, completion) in
    print("print - ", parameters?["message"] ?? "")
}, for: "print")

webView.bridge.register({ (parameters, completion) in
    print("print - ", parameters?["message"] ?? "")
    completion(.success(["key": "value"]))
}, for: "some_event_need_callback")

Native Call JS

webView.evaluateJavaScript("some_method();", completionHandler: { (results, error) in
    print(results ?? "")
})

webView.bridge.evaluate("some_method()", completion: { (results, error) in
    print(results ?? "")
})

JS Send Event

window.bridge.post('print', {message: 'Hello, world'})
// Post Event With Callback
window.bridge.post('print', {message: 'Hello, world'}, (parameters, error) => { <# Handler Parameters Or Error #>})

JS Register Native Event

var unregisterHandler = window.bridge.on('login', (parameters)=> {console.log('User Did Login')})
// To Remove Listener, call `unregisterHandler()`, Or Remove All Listener window.bridge.off('login')

Native Send Event To JS

webView.bridge.post(action: "login", parameters: nil)

You can include wk.bridge.min.js to your own html, or you can inject it to your html using WKUserScript.

You can Download full source-code of wk.bridge.min.js

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 8.0 +

Installation

WKBridge is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "WKBridge"

Author

[email protected]

License

WKBridge is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].