Getting user input string without using input box

I’m working on a Django project that deals with tracking time of employees. I am using a barcode scanner that outputs ASCII strings and want to be able to capture those strings without having to click on any type of input box; the webpage needs to be configured to accept and store strings as soon as it is launched. I have little to no experience with JavaScript, but I think an event listener on the document is the way to go. Sorry if this is a dumb question, any help is greatly appreciated. Thank you!