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:



, , ,




10 responses to “Firefox, xhtml, JBoss 4.2.0, JSF, and Google Ads”

  1. Bhaskar Avatar

    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 Avatar

    Worked perfectly. Thanks Devon.

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

  4. Liam Avatar

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

  5. j Avatar

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

  6. g Avatar

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

  7. Markus Avatar


    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.

    1. Devon Avatar

      @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 Avatar

    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 Avatar

    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 Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By :