Skip to content

Instantly share code, notes, and snippets.

@piotrmadry
Last active July 24, 2021 15:01
Show Gist options
  • Save piotrmadry/38dd526499cd927a5183e9ed60ec8cf1 to your computer and use it in GitHub Desktop.
Save piotrmadry/38dd526499cd927a5183e9ed60ec8cf1 to your computer and use it in GitHub Desktop.
private fun injectJS() {
try {
val inputStream = assets.open("style.js")
inputStream.bufferedReader().use(BufferedReader::readText)
} catch (e: Exception) {
null
}?.let { webView.loadUrl("javascript:($it)()") }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment