<a href="//996315.com/api/scan/?redirect_uri=修改成你要接收扫码结果页面的url地址">Scan</a>
<script type="text/javascript">
if (location.href.indexOf("qrresult=")>-1) alert(decodeURIComponent(location.href.split("qrresult=")[1]));
</script>
如果当前网址有多个参数或者#这样的锚点,建议修改为:
<a href="javascript:window.open('//996315.com/api/scan/?redirect_uri=' + encodeURIComponent(location.href), '_self');">Scan</a>
<script type="text/javascript">
if (location.href.indexOf("qrresult=")>-1) alert(decodeURIComponent(location.href.split("qrresult=")[1]));
</script>
如果你要扫的是条形码,那么建议修改为:
<a href="javascript:window.open('//996315.com/api/scan/?redirect_uri=' + encodeURIComponent(location.href), '_self');">Scan</a>
<script type="text/javascript">
if (location.href.indexOf("qrresult=")>-1) alert(location.href.split("%2C")[1]);
</script>
图片.png
图片.png
网友评论