[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>
Sat, 17 Mar 2012 00:52:44 +0000 (01: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.
Note: Thanks to Christoph Niewerth

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

index b8969d8..0e92e9b 100644 (file)
@@ -129,7 +129,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;
        }