1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Rep Power

    How to defer parsing JavaScript (in an XHTML page)?

    I was add defer to code but it is not validation.
    <script src=" http://example.com/ demo_defer.js" defer> </script>
    My site: http://trihung.com

    Anyone help me, please ?
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    Welcome to DevShed Forums, trihungpc.

    XHTML requires that all attributes have a value. In the case of "boolean attributes", you simply set the value to the name of the attribute:
    <script src="http://example.com/demo_defer.js" defer="defer"></script>
    By the way, you may not be aware that text/html should not be used with XHTML 1.1; use application/xhtml+xml instead or switch to XHTML 1.0 Strict or HTML5. IE versions before 9 don't support application/xhtml+xml. Simply changing the <meta> element does not work. This needs to be sent in the actual HTTP Response Header.
    Sending XHTML as text/html Considered Harmful
    Serving up XHTML with the correct MIME type
    Content-Typing XHTML

    Does your site actually use RDFa? I don't see any of it in the home page's XHTML.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo