generated from JetBrains/compose-multiplatform-template
-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Hi there! Have an issue with WebView on Compose Desktop app:
I have a structure in my resources/assets
index.html
index.css
index.js
In index.html I'm calling them:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Title</title>
<link href="index.css" rel="stylesheet">
</head>
<body>
.........
<script defer src="index.js"></script>
</body>
But in WebView both CSS and JS are not working.
Also, I tried fileChoose.html with styles.css from the sample - it also doesn't work.
Styles are not applied if they are in a separate file. CSS and JS inside an HTML file work fine.
This is my WebView code:
val webViewState = rememberWebViewStateWithHTMLFile(
fileName = "index.html",
readType = WebViewFileReadType.ASSET_RESOURCES,
)
val webViewNavigator = rememberWebViewNavigator()
LaunchedEffect(Unit) {
webViewState.webSettings.zoomLevel = 1.0
webViewState.webSettings.apply {
isJavaScriptEnabled = true
zoomLevel = 1.0
logSeverity = KLogSeverity.Debug
backgroundColor = Color.White
}
}
WebView(
state = webViewState,
modifier = Modifier.fillMaxSize(),
navigator = webViewNavigator,
webViewJsBridge = jsBridge
)
Metadata
Metadata
Assignees
Labels
No labels