"Well, Lois, the truth is I'm actually Superman in disguise, and I only pretend to be a journalist in order to hear about disasters as they happen and then squeeze you out of the byline."

~ Clark Kent ~

newsblog

2008-08-20

Joomla and SWFObject IE6 Base Tag Issue

One of the sites I've been working on recently introduced a couple of Flash elements to the layout. I've been using SWFObject 2 to write out the HTML to the page for these. Works fine in IE7, FF2, FF3 and Opera 9 but IE6 refuses to load the page. I viewed source on the page and noticed that Joomla had been outputting a HTML base tag. Experience told me that was a big no-no in terms of SWFObject. I thought I could just edit the base tag inside the template. Nope. Turns out it is added automatically by Joomla as part of its Header object. The fix is pretty simple and once done will apply to all the templates, this site uses 11.

Navigate to: /libraries/joomla/document/html/renderer/head.php
Find this line (line # 67 for me):

PHP:

$strHtml .= $tab.'<base href="'.$document->getBase().'" >'.$lnEnd;

Change it to this:

PHP:

$strHtml .= $tab.'<base href="'.$document->getBase().'"></base>'.$lnEnd;

That's it. Still works across all the previously mentioned browsers as well as IE6 and as a nice bonus it still validates under the XHTML 1.0 doctype.

Edit: I've written an updated version for the latest Joomla release, read about it here.

1 comment

# Yadira on 2009-02-13 at 12:34
Thank you!!!! I wanted to use swfobject because the only flash loader for Joomla that had decent javascript/flash detection only displayed my movie on the frontpage, no matter what settings I used. You're a lifesaver :D

This post has 1 feedback awaiting moderation...

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)

search