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:
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.
I dont know if you fully understand purpose of link.
Try to add to
Access-Control-Allow-Origin on server
Or
but you propably dont understand
This is serve to open zxing scanner get some code information and replace it in the given url after it is open like
.../scan!ret=www.host.com/product_{code}.hmtl
after scan it open web browser with
http://www.host.com/product_123.html