我没有在以下 Javascript 代码中打开提醒,而是希望重定向到从 QR码扫描中导入网址的网址,但遗憾的是不好使用 Javascript 。有什么帮助吗?
<script type="text/javascript" charset="utf-8">
function scanCode(){
cordova.plugins.barcodeScanner.scan(
function (result) {
setTimeout(function() {alert('Very good. ' + result.text);}, 500);
},
function (error) {alert("Scanning failed: " + error);
}
);
}
</script>
答案 0 :(得分:0)
将重定向作为HTTP重定向的版本:
<script type="text/javascript" charset="utf-8">
function scanCode(){
cordova.plugins.barcodeScanner.scan(
function (result) {
setTimeout(function() {windows.location.replace(result.text);}, 500);
},
function (error) {alert("Scanning failed: " + error);
}
);
}
</script>
点击链接时带有重定向的版本:
<script type="text/javascript" charset="utf-8">
function scanCode(){
cordova.plugins.barcodeScanner.scan(
function (result) {
setTimeout(function() {windows.location.href(result.text);}, 500);
},
function (error) {alert("Scanning failed: " + error);
}
);
}
</script>