page hash and backbutton issue phonegap+Jquery

后端 未结 3 1448
孤独总比滥情好
孤独总比滥情好 2020-12-22 00:03

I am new to phonegap programming and hoping someone can help me out here:

cordova 1.7.0, Jquery 1.7.2 and JQM 1.1.0 are used. The app is being tested on Android.

3条回答
  •  伪装坚强ぢ
    2020-12-22 00:23

    I had the same problem and used a workaround:

    Page layout:

        
        
        

    welcome

    jQuery:

    function onBodyLoad()
    {   
        //go to page_loading before deviceready without keeping it in browser history
        $.mobile.changePage('#page_loading', {reverse: false, changeHash: false});
        document.addEventListener("deviceready", onDeviceReady, false);
    }
    
    function onDeviceReady()
    {   
        //your initialization code here...
    
        //now go to page_1 without keeping it in browser history since the actual first page was #page_1 already       
        $.mobile.changePage('#page_1', {reverse: false, changeHash: false});
    
        //your code here...
    }
    

    This should fit your needs, just try it out...

提交回复
热议问题