0

Experts,
I've been searching all day for this, but I could not find one!
Is it possible to trigger android back button programmatically using javascript/jquery (other than cordova) ? Currently I am developing a cross-platform application that is not cordova-capable on this particular page. Thus, I am relying on javascript/jquery only.

Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
Adrianus Hendry
  • 143
  • 2
  • 9
  • Are you using webview? – Waqar Khan Apr 21 '15 at 06:47
  • @WaqarKhan i am.. its html5 based – Adrianus Hendry Apr 21 '15 at 06:53
  • First you have to Override `onBackPressed()`. Then you have to implement `JavaScriptInterface` in your activity. And call the `onBackPressed()` method from `JavaScriptInterface` This is well descirbed [here](http://stackoverflow.com/a/22897061/3117296) – Waqar Khan Apr 21 '15 at 07:00
  • @WaqarKhan Thanks! but i dont have control to that android activity class. Instead, i am now on an HTML page without cordova capabilities. I am looking for javascript or jquery to accomplish this. – Adrianus Hendry Apr 21 '15 at 07:29
  • Can you share some code? – Waqar Khan Apr 21 '15 at 07:33
  • @WaqarKhan iam afraid that it wont help. It is just a .html page. The android backbutton could navigate me to the previous page i visited, however history.back() or history.go(-1) could not. – Adrianus Hendry Apr 21 '15 at 08:18

0 Answers0