Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

IE formatting issue when placing code at top of page

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.

1 Solution
remmuhAuthor Commented:
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.

remmuhAuthor Commented:
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now