简体   繁体   English

在移动Web应用程序中处理页面堆栈

[英]Handling Page Stack in Mobile Web Application

We are constructing a mobile web application using PhoneGap and JQuery mobile. 我们正在使用PhoneGap和JQuery mobile构建一个移动Web应用程序。 Here is our flow: 这是我们的流程:

Gateway -> Login -> LoadDetails 网关->登录-> LoadDetails

    -> LoadDetails

From LoadDetails various other workflows are executed at the end of which the user is redirected back to LoadDetails with the information updated accordingly. 从LoadDetails执行各种其他工作流程,最后将用户重定向到LoadDetails,并相应更新信息。

Our goal in Android is for LoadDetails to be the topmost page in the application. 我们在Android中的目标是使LoadDetails成为应用程序中的最高页面。 Once a workflow is completed, hitting back on LoadDetails should exit the app. 工作流程完成后,点击LoadDetails即可退出该应用程序。

We have multiple ways of getting to LoadDetails, i have listed the two most common. 我们有多种获取LoadDetails的方法,我列出了两种最常见的方法。 Obviously, if the user logged in successfully and landed on LoadDetails we would not want the back button to return them to login. 显然,如果用户成功登录并登陆到LoadDetails,我们不希望后退按钮使他们返回登录。

Needs: - ability to remove pages from the stack 需要:-从堆栈中删除页面的能力

Thoughts? 有什么想法吗?

On your LoadDetails page you want to register a backbutton event listener. 在您LoadDetails页面要注册一个后退按钮事件监听器。 In the method that handles the event you'll want to call navigator.app.exitApp() to quit the application. 在处理事件的方法中,您将要调用navigator.app.exitApp()退出应用程序。 Something like this: 像这样:

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

function onBackKeyDown() {
   navigator.app.exitApp();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM