This version is old school.
Please find jQuery plugins on npm.
jQuery Scanner Detection
jQuery Scanner Detection is a small plugin to detect when user use a scanner (barcode, QR Code...) instead of a keyboard, and call specific callbacks.