[BUGFIX] Fix baseurl handling of IE with RTE htmlArea in FE and realurl
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 16 Mar 2012 23:50:44 +0000 (19:50 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 16 Mar 2012 23:52:58 +0000 (00:52 +0100)
Problem: IE does not support document.baseURI and document.URL is
incorrect when using realurl.
Solution: Get first base tag and extract href as base for iframe
document.

Change-Id: I845c3f617808235575d3af761e36ad188379c1b0
Resolves: #30847
Releases: 4.5, 4.6,4.7, master
Reviewed-on: http://review.typo3.org/6360
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index c221dbb..de2f0d6 100644 (file)
@@ -177,7 +177,17 @@ HTMLArea.Config = function (editorId) {
                // Custom tags (must be a regular expression)
        this.customTags = /none/i;
                // BaseURL to be included in the iframe document
-       this.baseURL = document.baseURI || document.URL;
+       this.baseURL = document.baseURI;
+               // IE does not support document.baseURI
+               // Since document.URL is incorrect when using realurl, get first base tag and extract href
+       if (!this.baseURL) {
+               var baseTags = document.getElementsByTagName ('base');
+               if (baseTags.length > 0) {
+                       this.baseURL = baseTags[0].href;
+               } else {
+                       this.baseURL = document.URL;
+               }
+       }
        if (this.baseURL && this.baseURL.match(/(.*\:\/\/.*\/)[^\/]*/)) {
                this.baseURL = RegExp.$1;
        }