Software Archive
Read-only legacy content

Back Button Wierdness

Ed_T_
Beginner
343 Views

I have an app using Bootstrap that was framed  out using app designer.

The hardware back button is being ignored most of the time. I added an event listener to detect when the backbutton event is fired:

document.addEventListener("backbutton", bbutton, false);

function bButton() { 
    var x = history.length;
    alert(x);
    window.history.back();
}

Using the SIMULATE tab's Fire Event Button does nothing, but when run on a phone this snippet never fails to register the event and to put up an alert showing the number of windows in the stack, but even the explicit call to back() doesn't make the app go back a screen, or reduce the value of x. Nor will the back button close the app's window.

I'm using sub pages created by app designer in this app. Should I be using pages instead? Would that behave differently?

Thanks

Ed

 

0 Kudos
3 Replies
Ed_T_
Beginner
343 Views

Then I saw:

https://software.intel.com/en-us/forums/intel-xdk/topic/591843

which answers my question about sub_pages thanks to Cris' explanation.

I chose sub_pages because I read somewhere that using pages was discouraged because it was slower.

Live and learn.

0 Kudos
Michael_O_2
New Contributor I
343 Views

My candid advice: Don't use the app designer that came with intel XDK in order to have full control and better understanding of the framework you are using.

0 Kudos
Ed_T_
Beginner
343 Views

Michael,

Respectfully I disagree. And it's not because I'm codeophobic or anything. I've been hand coding for 30+ years.

The App Designer is what drew me to XDK in the first place simply as a way to wireframe and organize an app. It's a really good tool for mastering the learning curve, because no matter what, you're going to spend a lot of time in brackets playing with App Designer's output anyhow. As Yoda would say, "Learn you must!"

The Project Management, Simulate, and Build features are what made me stay. <grin>

Still, the App Designer is a really useful tool, and if it were truly round-trip, could be a real time saver.

Ed

0 Kudos
Reply