Webviewko
webview for Kotlin Multiplatform, a tiny cross-platform webview library for desktop.
Install / Use
/learn @Winterreisender/WebviewkoREADME
webviewko
<!-- See [RFC4646](https://www.ietf.org/rfc/rfc4646.txt), [W3C language tags](https://www.w3.org/International/articles/language-tags/#bytheway) and [iana](https://www.iana.org/assignments/language-subtag-registry) -->English | 中文(简体)
webviewko provides a Kotlin Multiplatform binding to webview, a tiny cross-platform webview library to build modern cross-platform desktop GUIs using WebView2, WebKit and WebKitGTK.
Looking for Developers to Take Over This Project
Unfortunately, due to my busy schedule during graduate school and my loss of interest in the Kotlin technology, I am no longer willing to maintain this project.
If anyone is interested in taking over the maintenance of this project, please contact me by submitting an issue. I will hand over the development of this project to you.

Getting Started
1. Import webviewko
If you're using a build system like Gradle or Maven, it's recommended to import webviewko via GitLab Packages.
For build.gradle.kts, just use:
repositories {
mavenCentral()
maven("https://gitlab.com/api/v4/projects/38224197/packages/maven")
}
implementation("com.github.winterreisender:webviewko:0.6.0") // Kotlin Multiplatform
implementation("com.github.winterreisender:webviewko-jvm:0.6.0") // Kotlin/JVM and Java
implementation("com.github.winterreisender:webviewko-linuxx64:0.6.0") // Kotlin/Native Linux x64
implementation("com.github.winterreisender:webviewko-mingwx64:0.6.0") // Kotlin/Native Windows x64
implementation("com.github.winterreisender:webviewko-macosx64:0.6.0") // Kotlin/Native macOS x64
implementation("com.github.winterreisender:webviewko-js:0.5.0") // Kotlin/JS Node.js
- Additional steps are required for Kotlin/Native in Linux.
- If you are using
JitPack.ioplease movemaven("https://jitpack.io")belowmaven("https://gitlab.com/api/v4/projects/38224197/packages/maven")
2. Use webviewko
import com.github.winterreisender.webviewko.WebviewKo
WebviewKo().run {
title("Title")
size(800, 600)
url("https://example.com")
show()
}
3. Interact with webview
You can use bind,init,dispatch and eval to interact with your webview:
import com.github.winterreisender.webviewko.WebviewKo
WebviewKo(1).run {
title("Test")
init("""console.log("Hello, from init")""")
bind("increment") {
val r :Int = it.removePrefix("[\"").removeSuffix("\"]").toInt() + 1
println(r.toString())
if(r==8)
terminate()
"{count: $r}"
}
html("""
<button id="increment">Tap me</button>
<div>You tapped <span id="count">0</span> time(s).</div>
<script>
const [incrementElement, countElement] = document.querySelectorAll("#increment, #count");
document.addEventListener("DOMContentLoaded", () => {
incrementElement.addEventListener("click", () => {
window.increment(countElement.innerText).then(result => {
countElement.textContent = result.count; });});});
</script>""")
show()
}
Help
- API Reference
- GitHub Wiki
- Examples
- Test (Kotlin Multiplatform)
- TestKt (Kotlin/JVM)
- TestJava (Java)
- TestJS (Kotlin/JS)
- TestNative (Kotlin/Native)
- webview Documentation
- Demo: A CLI Tool Winterreisender/webviewkoCLI
Contribution
All suggestions, pull requests, issue and other contributions are welcome and appreciated.
Credits
| Project | License | |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| | webview | MIT | | webview_java | MIT | | webview-nodejs | Apache-2.0 | | node-ffi-napi | MIT | | JNA | LGPL-2.1-or-later OR Apache-2.0 | | Microsoft Webview2 | BSD-style | | Kotlin & kotlinx | Apache-2.0 |
License
Copyright 2022 Winterreisender and other contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Skills
node-connect
328.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
80.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
328.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
80.9kCommit, push, and open a PR
