这两天一直将一套html +js 移植到tomcat 的动态容器环境下
一直提示某个js 找不到 并且路径 不是我放置该js的位置
纠结了很久 js如下 找不到
var _WORKER_URL;
(function() {
// Worker creation Util
if (!_WORKER_URL) {
var WORKER_URL = "src/Worker.js";
}
else{
var WORKER_URL = "vixworker.min.js";
}
THREE.Util.createWorker = function() {
return new Worker(WORKER_URL);
}
})();
window.location.pathname
"/viewer/viewer.html"
动态下的路径 2
THREE.WebGLRenderer 71
window.location.pathname
"/bimatrixweb/web/nav/project/chat.html"
果然js 去找的那个奇怪路径就是和 路径2 很像
js自己在动态环境下 找的路径
修改后的
var _WORKER_URL;
(function() {
// Worker creation Util
if (!_WORKER_URL) {
//alert(window.location.pathname);
var WORKER_URL = "../../../resources/plugins/viewer/src/Worker.js";
}
else{
var WORKER_URL = "../../../resources/plugins/viewer/src/vixworker.min.js";
}
THREE.Util.createWorker = function() {
return new Worker(WORKER_URL);
}
})();