Build 'window.location.origin' for Internet Explorer

As TinyMCE's CodeMirror plug-in uses 'window.location.origin' which is not supported by Internet Explorer, the HTML or raw code editor does not work under Internet Explorer.
We need to create one in order to make these vendor codes work under Internet Explorer.
This commit is contained in:
louyihua
2014-05-29 12:50:11 +08:00
parent b2656bb24e
commit c0511bd1a9

View File

@@ -1,4 +1,4 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8 -*-
<%! from django.utils.translation import ugettext as _ %>
<%namespace name='static' file='static_content.html'/>
@@ -39,6 +39,12 @@
<script type="text/javascript">
window.baseUrl = "${settings.STATIC_URL}";
// Internet Explorer does not have built-in property 'window.location.origin',
// we need to create one here as some vendor code such as TinyMCE uses this.
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname
+ (window.location.port ? ':' + window.location.port : '');
}
var require = {
baseUrl: baseUrl,
waitSeconds: 60,