https://kotlinlang.org logo
#compose-web
Title
# compose-web
d

Daniele B

11/22/2023, 12:17 PM
is there a WebView component for Compose for Web? with "WebView" I mean a sandboxed browser, similar to what is available on Android and iOS, where you can also intercept events such as the page finished loading
😅 3
c

Chrimaeon

11/22/2023, 12:28 PM
You are in a browser 😅 just intercept the
window.navigator
events
d

Daniele B

11/22/2023, 12:36 PM
With mobile webviews you can also run Javascript to click on buttons and elements. You cannot do that in an iframe, if the page domain is different. I wonder if Compose is planning to add such WebView sandboxed component.
c

Chrimaeon

11/22/2023, 12:41 PM
I guess that would be highly inefficient to run a browser engine inside an browser. 🤔 supposedly that needs to be running as JavaScript or wasm
d

Daniele B

11/22/2023, 12:47 PM
I don't think a browser engine would need to be shipped inside Compose. There might be a way to reuse the browser's engine.
c

Chrimaeon

11/22/2023, 12:48 PM
Not really - compose is just an UI “framework”. In the end it just renders pixels on a canvas.
Or in the case of compose html interacts with the DOM tree
d

Daniele B

11/22/2023, 12:52 PM
I guess it would be possible to embed a sandboxed browser instance inside the canvas? But I am not an expert in this domain. That's why I am asking.
c

Chrimaeon

11/22/2023, 12:54 PM
a

andylamax

11/24/2023, 10:26 AM
i am not fully sure, but if I had a problem like yours, I'd try looking into Iframe, intercepting the navigator, or maybe using shadowRoot and web components to kind of scope/emulate your WebView
d

Daniele B

11/25/2023, 8:21 AM
@andylamax let's say you want to programmatically click on a SEARCH button in a website which has a different domain. In a mobile WebView you can do that, but in an iFrame you can't.
a

andylamax

11/25/2023, 8:35 AM
Blocked by CORS??
d

Daniele B

11/25/2023, 7:41 PM
Yeah
l

louiscad

11/25/2023, 9:02 PM
A browser extension might be the way to do it
8 Views