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):

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

Change it to this:

$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.

Share Article

Comments: 1

Leave a reply

Please fill in the form fields and improve Skynet by completing the captcha!

Thank you! All comments are moderated so yours will appear shortly.
  • Yadira

    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 😀

No reward is worth this.

— Han Solo