}
// 主要实现代码
window.location.href = scheme;
var startTime = Date.now();
var count = 0;
var endTime = 0;
var t = setInterval(function () {
count += 1;
endTime = Date.now() - startTime;
if (endTime > 800) {
clearInterval(t);
}
if (count < 30) return;
if (!(document.hidden || document.webkitHidden)) {
window.location.href = 'http://api.map.baidu.com/direction' + queryStr + '&output=html';
}
}, 20);
window.onblur = function () {
clearInterval(t);
};
} else {
alert('获取不到定位,请检查手机定位设置');
}
}
});
}









