
Lightweight in-app browser offering native UI and secure shared authentication, fast pre-warming and optimized rendering, plus a single-call API to open and programmatically close URLs.
π A lightweight in-app browser library for Kotlin Multiplatform.
Add the dependency to your build.gradle.kts of module:
commonMain.dependencies {
implementation("dev.yjyoon:kinappbrowser:1.0.0")
}Initialize KInAppBrowser in your Activity and open URLs:
import dev.yjyoon.kinappbrowser.KInAppBrowser
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Initialize KInAppBrowser with current activity
KInAppBrowser.init(this)
// Open URL in Chrome Custom Tabs
KInAppBrowser.open("https://github.com/yjyoon-dev/KInAppBrowser")
}
}No initialization needed - directly open URLs:
import dev.yjyoon.kinappbrowser.KInAppBrowser
// Open URL in SFSafariViewController
KInAppBrowser.open("https://github.com/yjyoon-dev/KInAppBrowser")
// Programmatically close Safari view controller when needed
KInAppBrowser.close()Works seamlessly with Compose Multiplatform:
@Composable
fun MyScreen() {
Button(
onClick = {
KInAppBrowser.open("https://example.com")
}
) {
Text("Open Website")
}
}expect object KInAppBrowser {
/**
* Opens the specified URL in the platform's native in-app browser.
*
* @param url The URL to open
* @throws IllegalStateException on Android if not initialized
*/
fun open(url: String)
}/**
* Initializes KInAppBrowser with the provided Activity.
* Must be called before using open() on Android.
*
* @param activity The Activity from which Custom Tabs will be launched
*/
fun init(activity: Activity)/**
* Closes the currently presented SFSafariViewController.
* Optional method for programmatic dismissal.
*/
fun close()Check out the sample app for a complete working example with Compose Multiplatform.
Copyright 2025 yjyoon
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.
π A lightweight in-app browser library for Kotlin Multiplatform.
Add the dependency to your build.gradle.kts of module:
commonMain.dependencies {
implementation("dev.yjyoon:kinappbrowser:1.0.0")
}Initialize KInAppBrowser in your Activity and open URLs:
import dev.yjyoon.kinappbrowser.KInAppBrowser
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Initialize KInAppBrowser with current activity
KInAppBrowser.init(this)
// Open URL in Chrome Custom Tabs
KInAppBrowser.open("https://github.com/yjyoon-dev/KInAppBrowser")
}
}No initialization needed - directly open URLs:
import dev.yjyoon.kinappbrowser.KInAppBrowser
// Open URL in SFSafariViewController
KInAppBrowser.open("https://github.com/yjyoon-dev/KInAppBrowser")
// Programmatically close Safari view controller when needed
KInAppBrowser.close()Works seamlessly with Compose Multiplatform:
@Composable
fun MyScreen() {
Button(
onClick = {
KInAppBrowser.open("https://example.com")
}
) {
Text("Open Website")
}
}expect object KInAppBrowser {
/**
* Opens the specified URL in the platform's native in-app browser.
*
* @param url The URL to open
* @throws IllegalStateException on Android if not initialized
*/
fun open(url: String)
}/**
* Initializes KInAppBrowser with the provided Activity.
* Must be called before using open() on Android.
*
* @param activity The Activity from which Custom Tabs will be launched
*/
fun init(activity: Activity)/**
* Closes the currently presented SFSafariViewController.
* Optional method for programmatic dismissal.
*/
fun close()Check out the sample app for a complete working example with Compose Multiplatform.
Copyright 2025 yjyoon
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.