Install network printer via web application (html)

╄→гoц情女王★ 提交于 2020-01-05 07:13:52

问题


I'm trying to write a simple web interface to allow users to install one of a few predefined network printers. I had initally thought this would be a simple task, as I can easily install printers via the run command by hitting the printer dead on (\printserv\printername). I had planned to either use that in the tag, or prefix it with a "file://" but both methods result in the following error

"\printserv\printername is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions."

I know I have permission to use this resource as I can install it via the run command. Any idea what I may be doing wrong, or an alternative solution?


回答1:


Opening local locations - whether on the filesystem or in the network - has become awfully difficult due to security reasons. I have yet to find a method that does this in Firefox for myself as a developer (with full access to the browser) so I can add direct links to my Web development IDE while browsing my web apps in debug mode.

I would recommend to detect the user's operating system (XP/2000/Vista/7/Whatever), display the network address in question big and fat in the center of the screen:

\printserv\printername

and then display customized step-by-step installation instructions:

  1. Click the "Start" button.
  2. Click "Run...."
  3. Copy and paste the address above into the field.
  4. Click "OK"

etc.




回答2:


The problem is that installing a printer is a "system" kind of activity probably requiring administrator access (it may be easy for you, but maybe not for others!). Now you're planning to run this operation through a browser!

Please consider this: If it were possible to run arbitrary administrative commands through your browsers, the Russian Mafia would already own all of your machines. Microsoft has punched enough holes in security that many, many Windows PCs are hacked, but it's still not quite as bad as the hole you would like to use.

A browser is a program, a way to look at pages on the 'net. It's not an administrative command interface for your PC.

Yet.

There is some trickery you can do with JavaScript in IE that will give you access to a lot of the underlying system. But whenever I post code, people yell at me. I'm not sure if it will do your printer installation for you, but if you insist, then try to get that code from somebody else. I honestly don't have it handy and would have to go digging deeply for it.



来源:https://stackoverflow.com/questions/3293350/install-network-printer-via-web-application-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!