Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB barcode hook #4

Open
hugopontesmiranda opened this issue Jun 13, 2017 · 3 comments
Open

USB barcode hook #4

hugopontesmiranda opened this issue Jun 13, 2017 · 3 comments

Comments

@hugopontesmiranda
Copy link

I think you can help me, do you know how can i hook the usb barcode scanner?
my scanner acts like a keyboard but i dont want that
i want a low level scanner.
So everytime the barcode reads it redirects to index.html?id=BARCODE_READED

hope you can help me.

@ericuldall
Copy link
Member

You should be able to use the same events and then just do a redirect.

$(function(){
	$(document).pos();
	$(document).on('scan.pos.barcode', function(event){
		//access `event.code` - barcode data
                window.location.href = '/index.html?id=' + encodeURIComponent(event.code)
	});
});

This library is designed to work with scanners that "act like a keyboard". It will not work in any other context. Assuming you are using this library the above code should help you achieve your result.

@hugopontesmiranda
Copy link
Author

I will try it today. but the problem is that it has to block the barcode from writing in other places

@hugopontesmiranda
Copy link
Author

the barcode will only work as a redirect device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants