I have an intranet app that needs to know where to print some labels. We have multiple workstations setup. I need a way to retrieve the host name of the client so that when they print something it comes out of the correct printer. Right now I have this being set at login but was curious if I could actually pull the host name on the client side, then on the server side i could easily parse the hostname to set the printer. The solves the problem of a user being logged into two workstations at once. Granted it shouldn’t happen but users will be users.
The application is printing labels to a zebra printer so the printing occurs on the server but the print job is sent to the label printer that is next to the workstation being used.
TIA!
Since the printing is done server-side, why do you need a JavaScript solution?
What you need is to check whatever is the equivalent to the REMOTE_HOST and/or REMOTE_ADDR CGI variables on your server’s implementation.
Edit: in case you can’t change the printing code, reverting to a separate script called through AJAX, as Andrew suggested, may be a way of getting what you want. But it looks like a very circuitous way of doing it.