Bug #13446
closedtx_Workspaces_Service_Fehooks::hook_eofe kills IE7 FE Javascript
Added by Anonymous over 13 years ago. Updated about 6 years ago.
100%
Description
When using the preview mode in TYPO3 frontend most of Javascript wont work in Internet Explorer 7 because of the hook "hook_feofe".
The entire content of workspaces/Resources/Private/Templates/Preview/Preview.html is interpreted and inserted at the beginning of the PHP and so kills the HTML integrity.
A way of fixing this is to set the following lines in the hook:
$workspaceVars = t3lib_div::_GP('tx_workspaces_web_workspacesworkspaces');
if(count($workspaceVars) == 0) {
return;
}
Files
Updated by Tolleiv Nietsch over 13 years ago
could you be a bit more precise? sure we add the whole template contents but what exactly is wrong in IE7 that this crashes?
Updated by Anonymous over 13 years ago
Hi,
the IE7 crashes because the HTML in clearly invalid.
in tx_Workspaces_Service_Fehooks::hook_eofe there is the following:echo $GLOBALS['TSFE']->cObj->cObjGetSingle(
'FLUIDTEMPLATE',
array(
'file' => 'EXT:workspaces/Resources/Private/Templates/Preview/Preview.html',
'variables.' => array(
'backendDomain' => 'TEXT',
'backendDomain.' => array('value' => $GLOBALS['BE_USER']->getSessionData('workspaces.backend_domain'))
)
)
);
This generates a huge amount of code that is just thrown in the php output.
The HTML Code will look like this:
<script type="text/javascript"> // @todo redirect to split module if this is opened standalone // having this is very important, otherwise the parent.resize call will fail document.domain = 'domainXY'; var asNumber = function(val) { return isNaN(val) ? 0 : parseInt(val, 10); }; var TYPO3 = {}; TYPO3.ready = function () { // make sure we're in the workspace preview module if (typeof parent.resize == 'function') { // try to find the height of the document var docHeight = Math.max( asNumber(window.innerHeight), asNumber(document.height), asNumber(document.body.scrollHeight), asNumber(document.body.offsetHeight), asNumber(document.body.clientHeight), asNumber(document.documentElement.scrollHeight), asNumber(document.documentElement.offsetHeight), asNumber(document.documentElement.clientHeight) ); parent.resize(docHeight); // remove the ugly red box if we're in the ws-repview frames var element = document.getElementById('typo3-previewInfo'); element.parentNode.removeChild(element); } }; // trigger this after content is loaded, inspired by jQuery if (document.addEventListener && !/opera/.test(navigator.userAgent.toLowerCase())) { document.addEventListener("DOMContentLoaded", TYPO3.ready, false); } else { (function() { if (document.readyState != "loaded" && document.readyState != "complete") { setTimeout(arguments.callee, 10); } else { TYPO3.ready(); } })(); } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> ...
This makes Internet Explorer overreacte (like little girls do when you take theire toys away) and break the javascript code.
Another way to fix this could be:
$params['pObj']->content = str_replace('</body>', $GLOBALS['TSFE']->cObj->cObjGetSingle( 'FLUIDTEMPLATE', array( 'file' => 'EXT:workspaces/Resources/Private/Templates/Preview/Preview.html', 'variables.' => array( 'backendDomain' => 'TEXT', 'backendDomain.' => array('value' => $GLOBALS['BE_USER']->getSessionData('workspaces.backend_domain')) ) ) ).'</body>',$params['pObj']->content);
I think that what really makes IE7 feel so bad is that he doesn't get why there is a HTML Tag after there has already been a script tag. Or worse, he just ignores the <script>-tags and this code gets never executed.
Greets
Tizian
Updated by Tolleiv Nietsch over 13 years ago
Thanks, I'd propose this patch - would be great if you could test it
Updated by Tolleiv Nietsch over 13 years ago
- Assignee set to Tolleiv Nietsch
- Target version set to 4.5.3
Updated by Tolleiv Nietsch over 13 years ago
- Status changed from Accepted to Under Review
Updated by Tolleiv Nietsch over 13 years ago
Updated by Tolleiv Nietsch over 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset commit:"9e9a5815c8ff69711d4720e62aff42be6fb2f6e5".
Updated by Oliver Hader over 13 years ago
- Target version changed from 4.5.3 to 4.5.3
Updated by Oliver Hader over 13 years ago
- Target version changed from 4.5.3 to 4.5.3
Updated by Simon Schaufelberger over 13 years ago
One question to that: The target version is 3.5.3 but the patch is still not applied. When will this patch be included in a minor release?
Updated by Michael Stucki almost 11 years ago
- Project changed from 624 to TYPO3 Core
- Category changed from Workspaces to Workspaces
- Target version deleted (
4.5.3)