Reply To: Browser back button

Welcome! Forums Unity Plugins In-App Web Browser Browser back button Reply To: Browser back button

#949
nano
Participant

Hi everybody,

Who can help me please with BACK button, why it isn’t working as should in browser ? Back button closes browser instead of returning to previous page as should.

How to make BACK button which will return to previous page ? Can anybody help me ? Look at next code snippet that I’ve tried in Unity C#, but this code doesn’t work ! Maybe I’m doing something wrong ?

void Start() {
LoadPage(“https://www.google.com/”);
}

void LoadPage(string url) {
InAppBrowser.DisplayOptions opts = new InAppBrowser.DisplayOptions();

opts.hidesTopBar = true;
opts.androidBackButtonCustomBehaviour = true;

InAppBrowser.OpenURL(url, opts);
}

public void OnBackClick()
{
InAppBrowser.ExecuteJS(“window.history.back();”);
}

void Update() {
if (Input.GetKeyUp(KeyCode.Home) || Input.GetKeyUp(KeyCode.Return) || Input.GetKeyUp(KeyCode.Escape)) {
OnBackClick();
}
}