从jQuery的处理早在Android的按钮 [英] handling back button in android from jquery

查看:88
本文介绍了从jQuery的处理早在Android的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开发jQuery中的应用与Android集成(其中只有一个活动)。通过这次活动,我们加载HTML文件,在这个文件中我们显​​示和隐藏股利内容。上观看网页,这里提供和pressing后退按钮在Android的提供,应用程序退出。我们希望应用程序转到previous页面上单击后退按钮。

We have developed an application in jQuery integrated with android (which has only one activity). From this activity we are loading an HTML file, on this file we are showing and hiding the div contents. On viewing the web pages provided here and pressing back button provided in android, the application exits. We want the application to go to the previous page on clicking the back button.

(点击上Android的后退按钮我们需要显示隐藏的div内容,并从DIV内容页面的应用程序应该退出点击Android的后退按钮。)

(On clicking the android back button we need to show the hidden div contents and on clicking the android back button from the div contents page the application should exit.)

推荐答案

试试这个:

function onDeviceReady() {
    // Add this line to the on onDeviceReady() function
    document.addEventListener("backbutton", onBackKeyDown, false);
}

// Handle back button hardware
function onBackKeyDown(e) {
    e.preventDefault(); // the default action of the event e should not be triggered. 
    history.back(1); // load the previous window.location
}

这篇关于从jQuery的处理早在Android的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆