View Full Version : Some general questions...

09-01-2006, 01:42 PM
I'm looking at building an intranet site for a company, but wanted to get some information before we finalise the specification (don't want to say we can do something when it's not possible).

My first real question is about how much power JavaScript has with regards to interacting with the users' computers? For instance I know it's possible to use JS to print a page, but is there a way to automatically select which printer using JS?

If JS isn't powerful enough are there any other computer languages that are more powerful that can be written into or called from the web pages? I.e. VB scripts?

Although this next question could be placed in another category, I'll ask here, as it's applicable. There may be a need to use a barcode reader, which would be connected to the odd PC via USB/Serial. I've never had any experience with using one of these devices; so don't know how well they'd interact with the system. My current assumptions are that they work just like the keyboard would but rather than inputting a single character it's a string of either numbers of binary, so I'd assume that if one of the input boxes on a website required a barcode reading the user could select the input box using the mouse and then just scan the barcode and the value would be entered into the box. Is this what happens? Or would it not be possible to use the bar code reader in this way?

Obviously with it being an internal network system, security issues and browser behaviour are controlled and can be altered to be exactly as needed.

Any help with all or any of these questions would be greatly appreciated.

Many thanks in advance,

09-01-2006, 04:10 PM
Rich, it seems like what you're attempting to do is centralize an internal business application and deploy it on-demand through your company's intranet. This is vaguely the technical lingo that describes your position

Unfortunately, what you're looking for is a bit difficult to provide. No, JavaScript does not have the power you are looking for. It may be possible to do this with VBScript in IE, but there are serious problems with that, including letting your application dictate your browser, which is never good.

What I would recommend as solutions are:
1) Signed Java Applets
2) Interesting server code

Signed Java Applets allow you to do a lot. You can read and write user files, you can execute standard actions like scanning, printing, and manipulating other hardware, and various other things. The benefit of Java Applets is that they are cross-browser, cross-platform, and can be controlled through JavaScript, so they don't even have to be displayed. They can run behind the scenes on the page, and you can write a javascript interface to it all. It can be VERY cool when executed properly.

Having said that, it's not always the right tool for the job. And here's where interesting server code can help.

Let's say, for example, you've got a network print server somewhere, and you want to be able to control which printer a specific document comes out from. If you try to use the user's computer to choose the printer many problems could arise. Perhaps they don't have the drivers for that printer, or they don't even know about the printer, they're not configured for it. In that case, no matter what your script is doing, it wouldn't have access to that printer. But if you have a network print server somewhere, you can write some server code that can be executed from your web server with whatever module you choose (perl/cgi, php, asp, jsp, etc). Then, you always know where to find the print server and you always know you can get it work, without user intervention.

So, as always, when asking high level questions, you get high level answers that read more like options.

A Java Applet will be able to use your barcode reader, JavaScript will only be able to manipulate the applet, not the barcode reader itself. Server code can be used to automate network communication on behalf of the user and provides great predictability and flexibility but it cannot interface directly with the hardware and software on the user's machine.

I hope this helps you in your attempt to formulate a solution for your company.

09-01-2006, 07:15 PM
Wow! That was certainly an interesting reply, and left my head a little reeling. No worries back the issue at hand.

I did have a feeling JS wouldn't be powerful enough, although with regards to the OS and browser compatability, these wouldn't be an issue as (unfortunately) it's already dictated as IE 6.0 and Win XP - company standard.

I didn't particularly want to use the page to dictate the browser, goes against all web design principals etc.

From what you've written it's going to be a combination of the Java applets and the 'intreresting server code', the Java to interact with the barcode scanner and the latter to do all the funky stuff with printing etc. To be honest there wouldn't be a lot of funky stuff to do, the system will mainly work with dbs etc and act very much like a standard website, it's just a few 'extras' that the client's interested in having that require it.

With regards to the interesting server code, what languages are we talking? I believe the server is a linux box.

Thanks for the reply, it's these things that I've never actually thought of doing; it's more computer programmer based stuff, and I'm only really a webdesigner.

Your further help would be appreciated, as would anyone elses input.

Many thanks in advance,