通过启动Web应用程序在Android zxing扫描仪似乎不工作 [英] Starting the android zxing scanner via web app doesn't seem to work
问题描述
我从一个Web应用程序扫描的出发点是本文这里一>
然后,我意识到这是因为点击这样的链接简单
但它没有工作。
我的web应用程序是简单的像这样的(从使用jQuery的AJAX)
$(#onebutton)。点击(函数(){
$阿贾克斯({
网址:http://zxing.appspot.com/scan
成功:函数(){
警报(成功);
},
错误:函数(){
警报(错误);
},
数据:{
REQ:HTTP%3A%2F%2F192.168.1.100:8080%2FMY_APP_NAME%2FMY_SERVLET%3F code%3D%7B code%7D
} });
});
不用说,#onebutton是与ID的按钮标记。当在android系统浏览器pressing这样的按钮,它总是提醒错误信息。它不要求扫描仪启动。
当我在一个普通PC点击按钮,控制台说:
原产地http://192.168.1.100:8080没有被访问控制允许来源允许的。
我是做错了什么?我这么想吗?
感谢大家提前!
您应该使用这样的链接,打开扫描仪:
< A HREF =zxing://扫描/ RET = HTTP://something.com/yourpage$status= {code}>
<跨度>我扫描与LT; / SPAN>
&所述; / A>
请,请注意,在我的例子$状态是一个变量这需要扫描的酒吧code的值。此传递的值作为它是导致网页的地址的参数。
我看到线程是有点老了,但我希望这会帮助别人。
My starting point for scanning from a web app was this article here Then i realized it was as simple as clicking a link like this
http://zxing.appspot.com/scan?req=http%3A%2F%2FLOCAL_SERVER_NAME%2FMY_APP_NAME%2FMY_SERVLET%3Fcode%3D%7BCODE%7D
but it didn't work.
My web app is simple like this (using ajax from jquery)
$("#onebutton").click(function(){
$.ajax({
url: "http://zxing.appspot.com/scan",
success:function(){
alert("success");
},
error:function(){
alert("error");
},
data:{
req:"http%3A%2F%2F192.168.1.100:8080%2FMY_APP_NAME%2FMY_SERVLET%3Fcode%3D%7BCODE%7D"
}
});
});
needless to say that "#onebutton" is a button tag with that id. When Pressing such button on a browser in android it always alerts the error message. It doesn't ask for the scanner to start up. When i click the button in a normal PC, the console says:
"Origin http://192.168.1.100:8080 is not allowed by Access-Control-Allow-Origin".
Am i doing something wrong?. Am i missing something?
Thank you all in advance!!
You should use a link like this to open the scanner:
<a href="zxing://scan/?ret=http://something.com/yourpage$status={CODE}">
<span>My scan</span>
</a>
Please, pay attention that in my example $status is a variable which takes the value of the scanned barcode. This passes the value as a parameter in the address of the page it is leading to.
I see that the thread is a bit old, but I hope this will help someone.
这篇关于通过启动Web应用程序在Android zxing扫描仪似乎不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!