问题
I am building a web service that gives VNC connections to remote machines. Currently I am using a project called novnc to embed the VNC inside a element in my web page. However, it is very slow, especially web browsers, eclipse etc. When I tried the VNC Viewer for Google Chrome webapp released by novnc, however, it seems really fast. This might be because its running native (native VNC clients are also very snappy). I was wondering whether I can have my users install the Real VNC webapp, but then invoke it from my webpage with the parameters (host, port etc) that I have specified? Basically, my webpage takes care of the management of these VMs (saving, creating, cloning etc), and I would like a fast implementation of VNC underneath which I can call from inside the browser (from my webpage). From the different ones I've looked into, this web app seems the fastest, but I don't know if/how I can invoke it with my given params.
回答1:
This bit of code from http://rogierg.blogspot.com/2007/03/run-vnc-and-rdp-from-hyperlinks.html may be helpful to you.
edit the following text to point to your VNC and save as C:\Windows\VNC.js:
var destination=(WScript.Arguments(0))
var search='vnc://'
//Modify the path to VNC Viewer!
var vncexe='D:\\Apps\\VNC\\vncviewer.exe'
//WScript.Echo(destination)
destination=destination.replace(search, '')
destination=destination.replace('/', '')
var ws = new ActiveXObject("WScript.Shell")
//WScript.Echo(vncexe + " " + destination)
ws.Exec(vncexe + " " + destination)
Save the next piece of text as VNC.reg and doubleclick:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\vnc]
@="URL:VNC Connection"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\vnc\DefaultIcon]
@="C:\\WINDOWS\\System32\\mstsc.exe"
[HKEY_CLASSES_ROOT\vnc\shell]
[HKEY_CLASSES_ROOT\vnc\shell\open]
[HKEY_CLASSES_ROOT\vnc\shell\open\command]
@="wscript.exe C:\\WINDOWS\\vnc.js %1"
来源:https://stackoverflow.com/questions/21614377/can-i-launch-vnc-viewer-for-google-chrome-webapp-from-my-web-page