We help IT Professionals succeed at work.

IE formatting issue when placing code at top of page

remmuh asked
Medium Priority
Last Modified: 2013-12-24
Somebody please help!

I am building an authorization system. A part of the system is adding pages that are to be protected. The way it will work is that a superuser will be able to browse parts of the site and click on a drop-down box at the top of any page and assign a role to that page to make it protected. I am testing the format of how the secure bar is going to work. You can see an example here:


As you can see, the bar sits at the top of the page with the drop-down box. It works fine in Firefox, Camino, and Safari, but as soon as I check it in IE on the PC it changes the formatting of the rest of the page. I know this is because I have viewable code where there isn't supposed to be any. The code is being called from the onRequestStart method in my Application.cfc file. This is why it must show up first on the page. Is there anyway to fix it so that IE does not change the formatting of the rest of the page? Also, I would rather not input an output variable on all the pages within the body text just to get this to fix. I am attempting to do this all through the onRequestStart function.

Watch Question


I did a quick cheap fix. I added all the header info that goes at the top of the page to fool ie into thinking the body had started. Sure this goes against all W3C standards, but you do what you gotta do sometimes. any other ideas would be great thanks.


FYI, it works fine in IE7 when I tested it. So Ie6 was probably breaking some standards.



indeed. thanks for the input.
No, it's not breaking standards.  By putting content before the doctype, you're triggering quirks mode.  This is known behavior.  In order to generate valid code, you need to figure out how to get these bits and bobbles within the body of the document.  I'd recommend an include with your conditional code for whether to display the extra bits and bobbles or not.
PAQed with points refunded (250)

Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.