语言

Menu
Sites
Language
Back to previous page using HW back button on web app based on Tizen Web UI Framework

Hello,

How i can navigate to previous page using HW Back button on web app based on Tizen Web UI Framework.

This code isn`t worked:

document.addEventListener( 'tizenhwkey', function(e) {
if (e.keyName === 'back') {
if ($.mobile.activePage.attr('id') === 'one') { tizen.application.getCurrentApplication().exit(); } else { history.back(); }
}});

I have following error:

TypeError: 'undefined' is not a function

 

响应

6 回复
Lakshmi Grandhi

can check where it is failing , which object is not be to find

Marco Buettner
document.addEventListener( 'tizenhwkey', function(e) {
if (e.keyName === 'back') {
      if ($.mobile.activePage.attr('id') === 'one')
      {
         tizen.application.getCurrentApplication().exit();
      }
      else
      {
         $.mobile.back();
      }
}});
Alexander AVSukhov

Hello,

This error in following string:

$.mobile.activePage.attr('id') === 'one'

ALSU

Hi,

Yes. I have error in this string.

Alexander AVSukhov

Hello,

Try to use $('.ui-page-active').attr('id') instead $.mobile.currentPage().attr('id')

Lakshmi Grandhi

It should contain compare operator "==" not "===".