我有一个使用 instascan 扫描 QR 码的应用程序,但是每次您在 android 手机上扫描 QR 码时,都会弹出带有解码结果的警报。例如,如果我生成了一个带有“我喜欢香蕉”的二维码,那么警报会显示“https://mywebsite.com 说我喜欢香蕉”。
有什么方法可以阻止此警报显示?它不会发生在我的笔记本电脑或平板电脑上,只有我的手机。如果您想查看,这是我的代码:
<video id="preview" visible="true"></video>
<script type="text/javascript">
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
//When a QR code is detected
scanner.addListener('scan', function (content) {
//If it is a url
if (content.match(/^http?:\/\//i)) {
//Redirect to new page
window.open(content);
} else {
var options = {};
options.url = "CameraList.aspx/GetContent";
options.type = "POST";
options.data = JSON.stringify({ content });
options.dataType = "json";
options.contentType = "application/json";
options.success = function (result) { };
options.error = function (err) { };
$.ajax(options);
}
});
</script>
任何帮助表示赞赏。