代码如下,先访问dcloud主页,再点击顶部的“文档”或“问答社区”,其url中含ask,因此被拦截,但并没有触发callback。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function plusReady() {
var wv = plus.webview.currentWebview();
wv.overrideUrlLoading({mode: "reject", match: ".*ask.*"}, function(e) {
console.log("reject url: " + e.url);
});
setTimeout(function() {
this.location.href = "https://www.dcloud.io/";
}, 1000);
}
if (window.plus)
plusReady();
else
document.addEventListener("plusready", plusReady, false);
</script>
</head>
</html>
2 个回复
8***@qq.com (作者)
应该这样写:
8***@qq.com (作者)