Quellcode durchsuchen

web client user agent

Milan Jurkulak vor 3 Jahren
Ursprung
Commit
c215002170

+ 6 - 2
tvlib/src/main/kotlin/org/mjdev/tvlib/ui/components/web/WebView.kt

@@ -24,14 +24,18 @@ import org.mjdev.tvlib.annotations.TvPreview
 fun WebView(
     modifier: Modifier = Modifier,
     url: String = "about:blank",
-    enableJavaScript:Boolean = true
+    enableJavaScript: Boolean = true
 ) {
     AndroidView(
         modifier = modifier,
         factory = { context ->
             WebView(context).apply {
                 background = ColorDrawable(0)
-                webChromeClient = WebChromeClient().apply{
+                settings.userAgentString =
+                    "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012)" +
+                            " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 " +
+                            "Mobile Safari/537.36"
+                webChromeClient = WebChromeClient().apply {
                     with(settings) {
                         javaScriptEnabled = enableJavaScript
                         allowContentAccess = true