Firefox, xhtml, JBoss 4.2.0, JSF, and Google Ads

/, Java, JBoss, Seam/Firefox, xhtml, JBoss 4.2.0, JSF, and Google Ads

Firefox, xhtml, JBoss 4.2.0, JSF, and Google Ads

I upgraded the JBoss instance on my server just over a week ago from 4.0.5 to 4.2.0. Two things happened after that: Firstly, my google adsense revenue dropped by half, secondly I was contacted by two different people who were having some e-mails show a big error in Firefox, instead of showing up correctly. I don’t use Firefox myself, I use Safari about 98% of the time and Camino when I find a site that doesn’t render correctly in Safari. Today I discovered, while working on a new ad layout, that in Firefox the Google ads weren’t rendering at all, throwing this error in the Firefox error console:

Error: uncaught exception: [Exception... "Object cannot be created in this context" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: " Line: 4"]

Basically iframes can’t be programatically inserted into strict xhtml elements. I did some googling and discovered that there were some discussions around this, but most of them simply said “either ditch google ads, or use text/html instead.” But I WAS using text/html, both in the meta content tag in the pages, and then later (while working on this issue) in the JBossWeb web.xml mime type configuration for xhtml, just in case. Using wget with –save-headers didn’t show anything unexpected. However, Firefox kept getting the response header saying the page was application/xhtml+xml which caused it to perform very strict validation, both breaking the google ads, and not letting sloppy tags or duplicated tags into the page, which are inherently going to happen when you’re rendering html e-mail within a page.

The cause of the break was not moving to JBossWeb in 4.2.0, nor any JBoss code itself. It turns out that when the JSF implementation was changed from MyFaces to Sun’s JSF-RI as part of the JBoss and Seam upgrade I did, the default content mime type changed as well. JSF-RI sets it to application/xhtml+xml. The fix was simple, add the following tag just before the tag in each .xhtml faclets page:

By |2007-06-10T15:01:03+00:00June 10th, 2007|10MinuteMail, Java, JBoss, Seam|10 Comments

About the Author:

Devon is a husband, amateur photographer, avid reader, and motorcycle enthusiast.


  1. Bhaskar December 9, 2007 at 11:54 pm - Reply

    its of great help I was facing the same problem but now its working after adding also I found if i add it resolves the issue for me I was surprised why is it so?

    Any ways Thanks for post!!

  2. Monkeyden February 9, 2008 at 5:53 pm - Reply

    Worked perfectly. Thanks Devon.

  3. […] You can solve this the same way you solve the JSF/Google Ad issue: […]

  4. Liam March 23, 2008 at 6:03 am - Reply

    Wicked, that solved the problem for me too. Much appreciated.

  5. j June 14, 2008 at 11:50 am - Reply

    Please, if you have time, check this images: and
    Something like this happen to me while using Firefox at

  6. g June 27, 2008 at 4:04 pm - Reply

    Damm…that was simple…..tried iframe,object and all kinda stuff….didnt expect it to be so easy to fix 🙂

  7. Markus March 30, 2009 at 2:47 pm - Reply


    Thanks for your post. I was facing exactly the same problem and launch date for the application is the day after tommorow. You saved me.

    • Devon March 30, 2009 at 6:12 pm - Reply

      @Markus: Great! I’m glad it was helpful! Good luck with your launch! Could you send me an e-mail or comment here with your new application once it’s live (assuming it’s a public app)? I’d love to see whatever it is.

  8. Drew October 14, 2010 at 11:54 am - Reply

    I know this is an old post but I thought I would mention that this just fixed my issue using JSF 2.

    My google ads weren’t showing on my site using Chrome or Safari, also an ssl seal from GoDaddy wouldn’t show up in these browsers either.

    I added at the top of my templates, just before the tag and the ads along with godaddy seal showed up immediately.

    I’m not sure if there is a correct place to set that properly in JSF 2 but this is the only thing I’ve found that works.

    Big thanks to this post!

  9. Adeel August 29, 2013 at 5:48 am - Reply

    Thanks…It solved my problem too. I have been looking for 10 years of this problem and because of this page I have managed to fix it.


Leave A Comment