<>以前var fileOrigin=函数(){ ,,,var 脚本=document.getElementsByTagName (“script"), ,,,,,,,文件名=& # 39;myFile.js& # 39; ,,,,,,,filePath=& # 39; & # 39;; ,,,(var i=scripts.length;我;我——){ ,,,,,,,如果(脚本(张).src.indexOf(文件名)在=0){ ,,,,,,,,,,,filePath=脚本(张).src; ,,,,,,,} ,,,} ,,,如果(filePath.match (/https ? \: \/\/(. * ?) \//)) { ,,,,,,,return filePath.match (/https ? \: \/\/(. * ?) \//) [0]; ,,,} ,,,//如果匹配不到,使用默认路径 ,,,return & # 39; https://test.com/& # 39;; }()