blog.Resource

Archive:

News-Feeds:


RSS 2.0
RSS 0.91
RDF
ATOM 0.3
August 18, 2008

SWFObject, Internet Explorer 6 and TYPO3: Can't We All Just Get Along?

Category: Ron Hall

The other day I was using SWFObject to place a Flash movie on a page. After entering the code it looked good in all browsers. All except IE6.

Now for a short pause while we all act stunned and surprised.

When accessing the page, IE6 would refuse to display it and instead just display an error message. It all stemmed from how IE6 handles the base tag. There are fixes posted on the web which involve feeding IE6 a full base tag instead of the valid self-closing tag. All that is fine an dandy except it is not quite that easy to do in TYPO3.

Using the config.baseURL in TYPO3 to set the base tag always results in a valid self-closing tag. Now, it is possible to not set the base tag through config.baseURL and instead include it in headerData. The problem with that approach is the base tag will fall after some of the TYPO3 included assets (like the CSS file containing CSS for some of the extensions). Since those are relative links there will be a problem if the base tag falls after them.

As I thought about this I remembered one of my earlier posts about modifying the TYPO3 header comment and decided to try something. I wrote this TypoScript:

 [browser= msie6]
config.headerComment (
This is to allow IE6 to see Flash
-->
<base www.mydomain.com/"></base >
<!--
)

[ELSE]
config.baseURL = www.mydomain.com

[GLOBAL]

So, what happens? All browsers but IE6 get a proper self-closing tag in the correct  location (like this), but IE6 gets a full base tag that falls before any linked asset (like this).

In effect what I have done on IE6 is added a short note to the TYPO3 header comment then prematurely closed the comment, added the full base tag and then reopened the comment. 


comments

comment #1
Gravatar: Risotto Risotto August 18, 2008 07:54
This is so ugly!

comment #2
Gravatar: Luc Luc August 18, 2008 09:26
It's not only a problem with flash object...

there's also errors with googlemaps and so on.

this should be patch inside the core....

comment #3
Gravatar: Loredana Loredana August 18, 2008 10:09
I had the same problem on IE6 with googlemaps, that couldn't display anymore.
After some researches, I found out that there was a problem with the tag which wasn't enclosed correctly.
I don't know if there is a patch to solve this problem, but I think these links can be usefull to get more details about it:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/3b9f5d5bf103a02b/e4f2cad7b3[..] fact, this error generates an "Operation failed..." on IE6 and the page wouldn't be displayed anymore.

comment #4
Gravatar: Loredana Loredana August 18, 2008 10:12
I see that the url to bug concerning this problem didn't show up in my previous message, so:
http://bugs.typo3.org/view.php?id=6301

comment #5
Gravatar: Dmitry Dulepov Dmitry Dulepov August 18, 2008 13:34
Funny. I closed that bug today with exactly the same recommentation: use conditional comments.

We cannot make the output of TYPO3 XHTML-invalid due to the old browser's bug :( So using conditions is the only way for now. Sorry.

It is not possible to make the solution in core due to caching.

comment #6
Gravatar: Oliver Leitner Oliver Leitner August 18, 2008 14:00
How about putting the conditional comments for ie6 as a page.config typoscript value?

That way you dont have to break your valid xhtml, and core still has the option to support ie6;)

comment #7
Gravatar: Dmitry Dulepov Dmitry Dulepov August 18, 2008 14:09
Oliver, core can't do it. It is admin, who makes TS conditions, etc.

comment #8
Gravatar: Oliver Leitner Oliver Leitner August 18, 2008 14:55
well, theres a config.no_cache param, i bet there could be a config.ie6_flash param;)

comment #9
Gravatar: Ron Hall Ron Hall August 18, 2008 17:37
I just looked at Dimitry's recommendation on the bug fix. That is also basically the approach I originally took to fix it but realized that if any of the included assets (css files, etc.) that fell before the base tag used a relative link then I would have a problem (at least I did with Safari). By including it the way I wrote about (through interupting the header comment) I was able to get the base tag in first position.

Like Dimitry, I have a tendency to leave the core alone when it comes to a fix for an improperly-coded, older browser that will eventually pass away (provided the problem can be fixed another way)

comment #10
Gravatar: Tobias Liebig Tobias Liebig August 22, 2008 10:42
Hej Ron,

in the last weeks i stumbled several times over this problem. Your solution works fine for me. Thanks!

On http://etobi.de/blog/artikel/weiterlesen/ie6-vorgang-abgebrochen/ (german only) i've evaluated the "self-closing-base-tag-problem".

regards
Tobias

Sorry, comments are closed for this post.