Navigation Controls for WebView

I’m writing an App that does a few things for our field technicians. I’m on the last part and I’m pretty stumped.

I have a page called Field Tech Guides. It is just a WebView that will load our wiki page with guides. I just want to add a back button to it. I searched the forum and documentation but was unable to find anything specific to WebView or how to send commands to it.

I saved this for last as I figured it would be the easiest (it probably is I just haven’t found a starting point to go off of). I’ve already built a custom REST API and have the app pulling records for the other parts of the app. I was able to find helpful documentation and get those parts done myself.

Any help is greatly appreciated!


Just to clarify, you want to add a back button with which you could navigate back inside the WebView? I’m not sure if that is possible :thinking: Perhaps it would be possible to get to the ”root page” of the WebView by setting the URL via page variable, but I’m not sure if that would work. I’ll try something out and get back to you tomorrow.

Yes, I’d like to add just an icon above the WebView component. When it is pressed it would tell the WebView component to go back a page.

While googling I found mentions of a webview.goback() function but if it exists in this plugin, I have no idea how to add that functionality to a button.

My other thought would be to create a wrapper webpage with a javascript back button and have webview just load that and it would in turn load the content. I rather do it as natively as possible though.

Hmm… I think you will have to go with the second option, as far as I know if that action would be possible for the WebView we have, we don’t have that currently available for use. :disappointed: You could make a feature request for us to add such functionality at some later point, or it would become available via third party plugins.

Okay, I’ll see if I can go that route and get it working. I appreciate your help! I’ll put in a feature request for it. Thanks again!

1 Like

You could experiment with the OnLocationChange Event the webview fires when its url changes then just have your button reset the webview url to whatever

1 Like

This might work as they’d only be going one page deep. I’ll give this a go and post my work if it works out to help anyone with a similar issue.

I sure appreciate the suggestion!

1 Like

The best approach would probably be to use the onLocationChange to keep track of the url stack in a page variable. The back button would then remove the last url from that list, and set the webview source to the newest last url after popping.

If you know your navigation is only one level deep, you could just store the initial url somewhere, and reset the webview url to that from the page button. You wouldn’t even need the onLocationChange event in that case, as you could set the back button visibility with a formula (e.g. pageVars.currentUrl != pageVars.initialUrl)

Please could you work me through the process of making my webview app go backwards one page at a time using the mobile phone back button