Hi folks, there is a way to open an external url i...
# compose-web
s
Hi folks, there is a way to open an external url inside a @Composable? I'm using
Copy code
val uriHandler = LocalUriHandler.current
and then inside a #Composable I use it as
Copy code
modifier = Modifier.clickable {
    uriHandler.openUri("<http://www.example.it|www.example.it>")
}
it works fine but open the link in an external browser window, I would like to open it inside the same composables. we cannot use WebView in compose-web, so any idea please?
a
@Stefano Milani u can do it using javascript. check online/chatgpt how it is done and call it from kotlin
iirc it's via
window
s
@Alex Styl I think what he's after is something webview-like on web. An iframe would do, but HTML interop is non-existent in Compose Web for now.
s
@Alex Styl yes I have already searched how to set javascript for IFrame but it needs to set some import implementation (compose.html.core) and I don't want to use html, I hoped that it could be accessed from window but it only opens the external link. Waiting for improvements I will leave the external link, I need it for the Google map. Thanks
👍 1
s
You don't even need Compose HTML (that's a totally different version of Compose). Just being able to use HTML iframe element would work, but unfortunately Compose Web doesn't support interop with native HTML elements just yet.
s
@Skaldebane Thank you, we wait... the roadmap for compose-web in not clear at the moment, the version continues to remain in alpha, when we will have new features?
a
I see. I thought you wanted to navigate to the given url instead of opening a new tab As Houssam said there is no official iFrame composable on web rn. Here are (creative) alternatives you have instead: • Create a composable that renders HTML yourself and add an iFrame there. There is a project that does this already. Here is a Ticket with more info • Create an <iframe/> in the page where your <canvas/> lives and show/hide it in your compose app using javascript.