KevinnZou / compose-webview-multiplatform

WebView for JetBrains Compose Multiplatform
https://kevinnzou.github.io/compose-webview-multiplatform/
Apache License 2.0
530 stars 69 forks source link

addargs to webview on desktop platform not working #97

Closed exdrcw closed 10 months ago

exdrcw commented 10 months ago

I want to pass some command line arguments into desktop webview, I tried the following code but it has no effect

                KCEF.init(builder = {
                    addArgs("--disable-web-security","--user-data-dir=~/chromeTemp")
                    installDir(File("kcef-bundle"))
                    progress {
                        onDownloading {
                            downloading = max(it, 0F)
                        }
                        onInitialized {
                            initialized = true
                        }
                    }
                    settings {
                        cachePath = File("cache").absolutePath
                    }
                }

I read the documentation and learned that the Desktop platform uses KCEF, and KCEF is a wrapper of JCEF. JCEF supports passing command arguments to CEFApp. Am I using it the wrong way? Or KCEF does not support this now?

btw, I just want to disable CORS restrictions in the webview, is there a better way to do it?

Thanks in advance to all the contributors to this project, it helped me a lot, thank you very much!

KevinnZou commented 10 months ago

@exdrcw Thanks for your feedback! It seems to be a issue with the KCEF library. @DatL4g Could you have a look at this issue?

DatL4g commented 10 months ago

Looks to me like the args a properly passed to the initialization process. Maybe take a look at jcef documentation, or create a CefAppHandler with onBeforeCommandLineProcessing