Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Allen 50 posts 71 karma points
    Oct 03, 2011 @ 15:41
    Tom Allen
    0

    Something very weird is happening

    Maybe I'm code-blind after too long at the screen, but can anyone see any reason why this line of HTML in my head tag would cause my entire page to break in standards-compliant browsers?

    <script type="text/javascript" src="/scripts/uTube/chromeless.player.js"></script>

    This line breaks the head element completely. I've just installed uTube on a fully functional Umbraco 4.7 site.

    If I comment it out thus, everything works (except uTube!):

        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <!--<script type="text/javascript" src="/scripts/uTube/chromeless.player.js"></script>-->
        <script type="text/javascript" src="/scripts/jquery.cycle.all.min.js"></script>
        <script type="text/javascript" src="/scripts/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="/scripts/bookmark.js"></script>
        <script type="text/javascript" src="/scripts/hoverIntent.js"></script>
        <script type="text/javascript" src="/scripts/superfish.js"></script>
        <script type="text/javascript" src="/scripts/supersubs.js"></script>
        <script type="text/javascript" src="/scripts/modernizr-2.0.6.js"></script>

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 03, 2011 @ 15:43
    Warren Buckley
    0

    Hey Tom,
    What do you mean by everything breaks, as I can't see any specifically wrong with that script tag.

    Can you provide more details, so we can see what the problem is.

    Cheers,
    Warren :) 

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 03, 2011 @ 15:44
    Lee Kelleher
    0

    Hi Tom,

    The HTML is correct, that's not the issue.

    Can you see any JavaScript errors when the script is included?  Which browser are you using? Chrome or Firefox should show you the errors in the console.

    Cheers, Lee.

  • Tom Allen 50 posts 71 karma points
    Oct 03, 2011 @ 15:57
    Tom Allen
    0

    Hi,

    Thanks for writing so quickly.

    What I mean is that Chrome/Firefox seem to encounter an error at this line and close the <head> tag prematurely, leaving the remainder of my <head> contents rendered as whitespace at the top of the <body> element. Here's the W3C validator output:

    Validation Output: 8 Errors

    1. Error Line 23, Column 87: Element head is missing a required instance of child element title.
      …ipt type="text/javascript" src="/scripts/uTube/chromeless.player.js"></script>
      Content model for element head:
      If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content.
      Otherwise: One or more elements of metadata content, of which exactly one is a title element.
    2. Error Line 130, Column 11: Element title not allowed as child of element body in this context. (Suppressing further errors from this subtree.)
       <title>Integrated IT Service Management, service desk and help desk softwar…
      Contexts in which element title may be used:
      In a head element containing no other title elements.
      Content model for element body:
      Flow content.

    It goes on to complain about subsequent head elements being in the wrong place, which they are not.

    Chrome reports no JS errors in the console, nor does Firefox.

    Like I said - weird!!!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 03, 2011 @ 15:59
    Lee Kelleher
    0

    Sounds like you are missing a <head> tag in your template?

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 03, 2011 @ 16:01
    Warren Buckley
    0

    Hey Tom,
    Just to be clear this is the W3C validator and not the browsers reporting this problem?

    The only thing I can think off, is that it may not like the filename of the JavaScript file, so I recommend you rename the file to  chromeless_player.js

    Let me know how that goes, as the W3C validator might have a strict rule about filenames or getting confused what the file extension might be.

    Cheers,
    Warren 

  • Tom Allen 50 posts 71 karma points
    Oct 03, 2011 @ 16:43
    Tom Allen
    0

    I have a head tag (!) and, without the offending line, the page validates.

    The issue crops up with both browsers and the W3C validator.

    Renaming as suggested seems to have solved the issue - but it's an odd one. Plenty of jQuery plugins have multiple periods in the filename...

    Thanks Warren!

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 03, 2011 @ 18:10
    Warren Buckley
    0

    Hey Tom,
    Not sure why it would be a problem, but glad to hear you have it fixed. 

    Warren

Please Sign in or register to post replies

Write your reply to:

Draft