can't load XRegExp twice in the same frame

 1 angular.js:9959 
 2 Error: can't load XRegExp twice in the same frame
 3     at Error (native)
 4     at eval (eval at <anonymous> (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:4:4994), <anonymous>:12:11)
 5     at http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:4:4994
 6     at Function.x.extend.globalEval (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:4:5005)
 7     at x.ajaxSetup.converters.text script (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:15925)
 8     at On (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:15583)
 9     at k (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:13940)
10     at r (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:18646)
11     at Object.send (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:18771)
12     at Function.x.extend.ajax (http://我的ip地址/vender/jquery/jquery-1.10.2.min.js:6:13722) <div ui-view="" class="ng-scope">

不能在相同的框架中加载两次XRegExp

一般错误的抛出是来自:Syntaxhighlighter/shCore.js

var XRegExp;

if (XRegExp) {
    // Avoid running twice, since that would break references to native globals
    throw Error("can't load XRegExp twice in the same frame");
}

目前,我的解决办法是在使用了angular ui-view的框架中,直接将

<link rel="stylesheet" href="/vender/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" />

<script src="/vender/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>

直接移到index.html首页中,这样在跳转到同一个模板的视图中加载两次Syntaxhighlighter/shCore.js。

或者取消这个判断。 

具体的代码和详细的过程、细节还没有弄懂,学习的过程中再慢慢理解 ^_^

原文地址:https://www.cnblogs.com/shiddong/p/5660067.html