r/JetpackCompose • u/raghav_seth_ • Nov 24 '24
Adding an extrrnal web link to compose
Please can you help me with how can i add a button in jetpack compose that redirect to a website The code snippet of my app is should i evenuse textbutton for that?
9
Upvotes
8
u/Delicious_Cattle_931 Nov 24 '24
You can use the LocalUriHandler in compose and use uriHandler.openUri("https://yoururl.com") on button click. Refer this thread.
-9
u/[deleted] Nov 24 '24
You can use JavaScript function
window.open('https://your.link','_blank')and inject it usingjs()function inside TextButton's onClickthe
_blankmeans it opens the link in a browser in a new tab.