Files
noVNC/include/vnc.js
Joel Martin 2cde6e4380 include/vnc.js: dynamic load without document.write.
Instead of using document.write to load scripts, use createElement to
create and append script tags. document.write is problematic in a lot
of situation and in particular is not allowed in a Chrome
extension/packaged app.

Also, in webutil.js, instead of calling init_logging during parsing of
include/webutil.js, rely on the caller to do this. The problem is that
calling init_logging on parse tries to call Util logging functions and
the new model of dynamic load may not having Util loaded by the time
webutil is parsed.
2012-09-17 17:15:49 -05:00

36 lines
962 B
JavaScript

/*
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Licensed under LGPL-3 (see LICENSE.txt)
*
* See README.md for usage and integration instructions.
*/
/*jslint evil: true */
/*global window, document, INCLUDE_URI */
/*
* Load supporting scripts
*/
function get_INCLUDE_URI() {
return (typeof INCLUDE_URI !== "undefined") ? INCLUDE_URI : "include/";
}
/*
* Dynamically load a script without using document.write()
* Reference: http://unixpapa.com/js/dyna.html
*/
function load_scripts(base, files) {
var head = document.getElementsByTagName('head')[0];
for (var i=0; i<files.length; i++) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = base + files[i];
head.appendChild(script);
}
}
load_scripts(get_INCLUDE_URI(),
["util.js", "webutil.js", "base64.js", "websock.js", "des.js",
"input.js", "display.js", "rfb.js", "jsunzip.js"]);