如何控制jquery mobile中显示在导航栏中的url

如何控制jquery mobile中显示在导航栏中的url,jquery,html,jquery-mobile,mobile,single-page-application,Jquery,Html,Jquery Mobile,Mobile,Single Page Application,我正在开发一个jQuery移动应用程序,它只在一个静态url下工作,可能它调用单页应用程序 当我在mobileinit事件中使用$.mobile.changePage.defaults.changeHash=false时,它可以通过单击导航到其他页面的链接很好地工作,url永远不会更改。但是当我输入一个带有标签的完整url时,url会发生变化http://www.example.com/home/index#catelog/lists在导航栏中,url转到http://www.example.c

我正在开发一个jQuery移动应用程序,它只在一个静态url下工作,可能它调用单页应用程序

当我在
mobileinit
事件中使用
$.mobile.changePage.defaults.changeHash=false
时,它可以通过单击导航到其他页面的链接很好地工作,url永远不会更改。但是当我输入一个带有标签的完整url时,url会发生变化http://www.example.com/home/index#catelog/lists在导航栏中,url转到
http://www.example.com/catelog/lists
。在这种情况下,
$.mobile.changePage.defaults.changeHash=false
似乎不起作用

那么,如何控制jQuery Mobile仍然显示
http://www.example.com/home/index

在头部:

<script type="application/javascript" src="js/libs/jquery-1.11.2.min.js"></script>
<script>
    window.addEventListener('DOMContentLoaded', function() {
        if (window.history && window.history.pushState)
            window.history.pushState('', '', window.location.pathname) 
        else
            window.location.href = window.location.href.replace(/#.*$/, '#'); 
    }, true);
    $(document).on('mobileinit', function () {
        // If you need it:
        $.mobile.hashListeningEnabled = false;
        $.mobile.pushStateEnabled = false;
        $.mobile.changePage.defaults.changeHash = false;
    }
</script>
<script type="application/javascript" src="js/libs/jquery.mobile-1.4.5.min.js"></script>

addEventListener('DOMContentLoaded',function(){
if(window.history&&window.history.pushState)
window.history.pushState(“”,,,window.location.pathname)
其他的
window.location.href=window.location.href.replace(/#.*$/,'#');
},对);
$(文档).on('mobileinit',函数(){
//如果您需要:
$.mobile.hashListengEnabled=false;
$.mobile.pushStateEnabled=false;
$.mobile.changePage.defaults.changeHash=false;
}