1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ColdFusion9 Forcing <META> tag order in <HEAD>

Discussion in 'Programming' started by 137th Gebirg, Aug 3, 2016.

  1. #1
    Hello all. Running into an odd ColdFusion rendering problem that I can't seem to bypass. Namely, when I attempt to specify a compatibility mode (using the IE9 rendering engine) in a page that's using ColdFusion objects (CFPOD, CFLAYOUT, CFFORM, etc.), the CF interpreter adds a bunch of JavaScript libraries in front of my META tags in the <HEAD> block. Problem with that is, unless <META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=9"> is the first line of code in the <HEAD> block, it will be ignored and IE renders the page in IE7 compatibility mode, which I have discovered is potentially more horrible an engine than IE6 (didn't think that was possible)! Removing the CF objects from the page renders the HTML properly, in IE9 compatibility mode. Unfortunately, I need these CF objects for the project I'm working on. Here's the sample code...

    Pre-rendered code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <HTML XMLNS="http://www.w3.org/1999/xhtml">  
      <HEAD>
        <!--- Begin custom tags (which I really want to be at the top --->
        <META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=9"> <!--- This MUST be first in the <head> block or it will be ignored --->
        <TITLE>ColdFusion app title</TITLE>
      </HEAD>
      <BODY>
        <!--- Code using CFPOD, CFLAYOUT, CFFORM, etc. --->
      </BODY>
    </HTML>
    
    Code (markup):
    Code as it's been rendered by ColdFusion when it gets to browser:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <HTML XMLNS="http://www.w3.org/1999/xhtml"> 
      <HEAD>
        <script type="text/javascript">
          /* <![CDATA[ */_cf_loadingtexthtml="<img alt=' ' src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";
          _cf_contextpath="";
          _cf_ajaxscriptsrc="/CFIDE/scripts/ajax";
          _cf_jsonprefix='//';
          _cf_clientid='884342D5DD92B59E09FAA8AED19BFA39';/* ]]> */
        </script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/messages/cfmessage.js"></script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/package/cfajax.js"></script>
        <link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/resources/cf/cf.css" />
        <script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/yui/animation/animation-min.js"></script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/ext/adapter/yui/ext-yui-adapter.js"></script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/ext/ext-all.js"></script>
        <script type="text/javascript" src="/CFIDE/scripts/ajax/package/cflayout.js"></script>
        <link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/resources/ext/css/ext-all.css" />
     
        <!--- Begin custom tags (which I really want to be at the top --->
        <META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=9"> <!--- This MUST be first in the <head> block or it will be ignored --->
        <TITLE>ColdFusion app title</TITLE>
      </HEAD>
      <BODY>
        <!--- Code using CFPOD, CFLAYOUT, CFFORM, etc. --->
      </BODY>
    </HTML>
    
    Code (markup):
    Does anyone know if there is a way to either force the CF JavaScript code to position itself at the end of the <HEAD> block, or a way to force my compatibility string to the top, ahead of the CF JS code?

    I did try using the <CFHTMLHEAD TEXT="..."> tag, but it only put whatever I entered in the "TEXT" parameter at the bottom of the <HEAD> block, which is even worse.

    Any assistance appreciated.
     
    137th Gebirg, Aug 3, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    I have no idea, but there are other problems - among them, that HTML tags are lowercase. No exceptions. (Well... !DOCTYPE declaration is uppercase ;)

    Why are you even using XHTML transitional as doctype? Are you parsing XML anywhere? If not, drop it, and use the HTML 5 doctype instead: <!DOCTYPE html>

    As for the objects, and the use of ColdFusion, I'm not even gonna bother. Drop CF, and use something useful.
     
    PoPSiCLe, Aug 3, 2016 IP
  3. 137th Gebirg

    137th Gebirg Active Member

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Negative - on all three.
    1. HTML is NOT case sensitive. Period. Makes absolutely no difference, and never has. I UCase all my code because nobody else does and when others inevitably change my code without letting me know, leading to process breakage, I have instant proof that it was someone else. It has made a world of difference in solving attribution problems over the years and they never notice it until it's too late and they get cornered for breaking code. Makes it so nobody can say "it wasn't me" - except me.
    2. In my environment, there are older browsers which must be accounted for and compatibility maintained. Full support for HTML 5 and CSS 3 isn't entirely there. Hell, the client only just recently dropped IE6 as an enterprise standard last year in favor of IE8. Some workstations even have IE10! FireFox is there, but for development purposes (using FireBug) only. Would I like to drop IE entirely in favor of a better browser? Most certainly yes. Can I? No. Rules of the game.
    3. "Drop CF"? Not useful indeed, but thanks for trying.
    Next?
     
    137th Gebirg, Aug 8, 2016 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    1. If you have to do that kind of battles, use a proper versioning system.
    2. What does older browsers have to do with anything? ANY browser can use the HTML 5 Doctype. It just makes it simple, and forces proper rendering in idiotic browsers (IE, I'm looking at you).
    3. Yeah, it's useful, since CF is a bloated, retarded piece of shit, and uses non-standard constructs (which, I understand now, probably is why the XHTML-doctype is used, for creating custom tags).

    As I said, drop the trainwreck, and use proper code.
     
    PoPSiCLe, Aug 8, 2016 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #5
    First off, why are you even using that X-UA rubbish? That ONLY exists to tell IE that the page's code inhales upon the proverbial equine of short stature -- if you "need' that meta, you are probably doing something horrifyingly and terrifyingly WRONG with your markup. (or CSS)

    Second, while browsers aren't case sensitive, the SPECIFICATION has been since HTML 4 was introduced, Joe forbid you follow the specification...

    Third, if I had a site with that many scripts in the <head> I'd grab the 30-06 off the wall and drag it 'round back o' the woodshed to give it the Old Yeller treatment.

    Well, to be fair if I had a page with that many separate scripts all hosted off the same domain...

    You've got a tranny document, maybe it's time to put on the big boy pants and stop writing websites as if it's 1997? Even when 4 (and X1.0) were new, tranny was for outdated pages to use new features, NOT for writing new pages. Makes me suspect the rest of your site is probably HTML 3.2 masquerading as XHTML.

    Finally... wow, people STILL use Coldfusion? I'd think the way it pisses all over everything with pointless scripttardery and gibberish markup would have FINALLY driven people away from using that steaming pile... oh wait, steaming piles seems to be the order of the day with "modern" practices dragging everything back to the WORST of the 1990's, so CF fits right in with Codeignitor, laravel, turdpress, bootcrap, YUI, and all the other idiotic halfwit "how not to build a website" rubbish people are using.
     
    Last edited: Aug 12, 2016
    deathshadow, Aug 12, 2016 IP
  6. 137th Gebirg

    137th Gebirg Active Member

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    Guys - I'm not here to engage in a flag-waving debate over which is the best language. I've worked with over 20 languages since I started coding and they're all if/then/else at the end of the day. Are there "better" languages out there? Sure. But this is what the customer is using, and there's no point in debating that, as it is a customer that doesn't make changes easily or smartly (as I mentioned in an earlier post).

    So...I'm looking for someone who is a CF guru (if they're still around any more) who knows if there is a way to re-order the automatically-generated JS scripting references in the <HEAD> block. If you're not that, you need not respond, and please spare me the elitist BS on "wh0z d4 b3tt3r c0d3z h4xx0r". It's nothing more than trolling, plain and simple, and yes, totally unuseful.

    Thx.
     
    137th Gebirg, Aug 18, 2016 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #7
    I would still say that if the reason you want to do this is to get that X-UA nonsense first, just fix the CSS and markup instead of slopping that X-UA nonsense in there. If you need to force IE's compatibility mode, the problem is NOT something you should be forcing compatibility mode to address!

    Fix the rest of the code, don't throw that sloppy hack at it. Really if you can't get the code to the point where it works without X-UA, there's something HIDEOUSLY wrong going on with it.
     
    deathshadow, Aug 18, 2016 IP