I have an iframe in my app that has an svg with links in it. Is is possible when I click a button in the iframe container to open a page in my app?
Hmm I don’t know about iframes, but you can use a WebView component to display a web page inside your app.
Would it be possible that when I click a link in a website in the WebView component, it opens a page inside the app?
I think it’s possible, using the WebView’s onLocationChange event.
You can get the new URLfrom the onLocationChange event as Mevi suggested, and use formulas or a script to extract the necessary parameters from it (e.g. id, resource type corresponding to pages in your app, etc). Then you can simply use the normal navigation functions like Open page to open a new page in your app.
The challenge is that the WebView navigation does still trigger, and you get the new URL from onLocationChange after the fact. Depending on how critical it is to be back on the original page after the user navigates back from the newly opened page, here are a few suggestions:
- Leave as-is if it’s not a big deal in your use case.
- Store the original URL and set the WebView source back to it before completing your navigation flow.
- Tinker with the URLs in the webview so that they do not actually navigate to a different page. Probably several ways to go about it, but you can at least remove the protocol and convert it to an anchor link (https://example.com -> #example.com). You’ll still get the onLocationChange event, but no page change happens in the WebView.
Hi! Thank you for the help. Can teach me how to do it? I’m creating an app for our online radio station as students. I’m new to this thing. Thanks.