I am 99% sure this isn't possible but I'll ask just incase someone has an idea.
A little background:
My users use a barcode scanner to consign items off the system. Each barcode is an ID number preceded with a "^" (so the system can tell if someone is scanning rather than just typing). As they scan each barcode the page automatically downloads a PDF (into an iframe) which is printed onto a label and stuck on the box. Then they move onto next and the next etc.
The automatic printing is handled with an onkeypress
event attached to the document. This is the called function:-
function quickEntry() {
if (String.fromCharCode(event.keyCode) == "^") {
if (!scanning) {
grn = '';
scanning = true;
setTimeout('addBarcode()', 1000);
}
else {
alert("Still processing previous GRN.");
}
}
else
grn += String.fromCharCode(event.keyCode);
}
The Problem:
The problem is that after printing the first label the user needs to click on an area of the main html document before they can scan a barcode again even though the window itself still has focus.
Edit
Anyone arriving on this question take a look at this question for more up-to-date answers.