<script>
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
}
return null;
}
// 跳转至小程序
if(getUrlParam('target') === 'miniprogram' && !getUrlParam('path')) {
location.href='weixin://dl/business/?t=sllFuPPYHYb'; // 列表页
}
// 跳转至APP
if (getUrlParam('target') === 'app') {
var ua = navigator.userAgent.toLocaleLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
document.getElementById('wechat').style.display='block';
}
if (getUrlParam('type') === 'todo') {
location.href = 'todolist://list?scene=' + getUrlParam('sid');
} else {
location.href = 'todolist://';
}
}
</script>
这几条代码是在腾讯待办”小程序正式发布的时候邀请我体验的时候在页面中看到的。
有可能会有很多朋友会需要这个,所以就保存一下!