html获取请求参数
function getRequest() {
var url = window.location.search; //获取url中"?"符后的字串
var theRequest = new Object();
if(url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for(var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]); //用了unescape()会出现乱码
}
}
return theRequest;
}
var plate = getRequest().id;
href:zcar://goodsdetailed.com/?id=1
android:
在所在的activity添加intent-fiter
activity获取值
Uri uri = getIntent().getData();
Stringtype= uri.getQueryParameter("type");
Stringid= uri.getQueryParameter("id");
网友评论