2012-03-04 60 views

回答

2

您可以使用下面逻辑

在您的index.html添加下面的脚本

var version = "2.0" 
document.addEventListener("deviceready", onDeviceReady, false); 
function onDeviceReady() { 
    var current_version = window.localStorage.getItem("version"); 
    if(current_version != version){ 
     navigator.notification.confirm(
       'Please accept terms and conditions', 
        onConfirm, 
       'T&C', 
       'Ok, Cancel' 
     ); 
    } 
} 

function onConfirm(button) { 
    if(button == 'Ok'){ } else {} 
} 
3

你可以设置一个localStorage的项目是开放的检查,看它是否已被接受,也可能是版本号,以便每次更新推你的逻辑时说像

if(localStorage.getItem(version) == "1.0){ 
    console.log("already set"); 
} 
else { 
    console.log("need to accept"); 
    // fire alert or confirmation box once complete set version to 1.0 
} 
+0

我给这个一杆。谢谢! – jasonflaherty 2012-03-06 23:39:33