phonegap + framework7 how to programmtacally set starting page?

后端 未结 2 1323
野趣味
野趣味 2020-12-12 05:48

I have application which on start lets you pick - if are you contributor or user. After that I want always load the starting page for a contributor or the user. I know you c

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 06:10

    You must use

    localStorage

    to save data if user pick contributor or user button after first start. Simple use jQuery script:

    
    

    And call this same script but for user:

    
    

    So on next html page control if user is previously press "user" or "contributor".

        $(document).ready(function() {
    
           if (localStorage.getItem("user") === null) {
               //user is null
           } else {
               document.location.href = "userIndex.html"
           }
           if (localStorage.getItem("contributor") === null) {
               //contributor is null
           } else {
               document.location.href = "contributorIndex.html"
           }
    });
    

    Good luck!

提交回复
热议问题