我的设备后退按钮工作不正常,它转到第一个html,但返回到第二个html

My device back button is not working properly it goes to first html but return back to second html

本文关键字:html 第一个 第二个 返回 按钮 工作 不正常 我的      更新时间:2023-09-26

我在jquery mobile(html5,javascript),cordova 3.2的帮助下在android中制作一个应用程序,其中有两个html页面来自index.html。我在document.location.htm的帮助下调用home.html,但问题是我的设备后退按钮无法正常工作当我每次点击设备上的后退按钮时,它都会转到index.html,但返回到home.html如何解决这些问题请帮我解决

index.html

    <div data-role="content">
        <a data-role="button" data-inline="true" id="subBtn">Submit</a>
    </div>

one.js

    $("#subBtn").unbind("click").click(function() {
        submitButton();
    });
    function submitButton(){
        document.location.href = "home.html";
    }

home.html

    <div data-role="content">
        <p>welcome to home page</p>
    </div>

使用location.href="yourpagename.html"

这样使用它:

window.location.href = "home.html"