Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    If I serve a valid XHTML 1.1 document as application/xhtml+xml and embed Javascript in the page like so:
    HTML Code:
    <script type="text/javascript">
    <![CDATA[ alert('foo'); ]]>
    </script>
    ...the script doesn't execute. CDATA is apparently the proper way of serving non-markup data in XML documents (XHTML 1.1 is pure XML). It works in Firefox. IE doesn't understand a damn thing and doesn't even understand application/xhtml+xml, but I don't care at all about IE for this project.

    After all that jargon, ideas?
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    Don't know if this is anything or not ...

    I found this in a Sams Publication:

    <script type="text/javascript">
    //<![CDATA[

    alert("<This is compatible with XHTML>");

    //]]>
    </script>


    QUOTE:
    Note that JavaScript source code must be placed within the opening and closing elements of the CDATA section. The CDATA section itself should be commented out with a JavaScript single-line comment // as in the example above. This is so that the JavaScript interrupter does not interpret the CDATA markup as JavaScript, which would cause a JavaScript error.


  4. #3
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    It just started working on its own. I kid you not; I didn't change any code.

    (without the Javascript comments...although realistically I see no harm in including them)
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    *cough* You shouldn't be embedding Javascript inline *cough* :-D

  6. #5
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Necessary for this.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    @Shadowfiend: do you mean all JS should be put in a js file?

    Sounds obvious but I am not sure.

  8. #7
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Ideally. Same with CSS.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  9. #8
    Senior Member aubreyisland's Avatar
    Join Date
    Oct 2005
    Posts
    125
    Member #
    11643
    Why wouldn't you want it in a js file where you can control the actions globally?

  10. #9
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    It contains some variables set dynamically by PHP.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  11. #10
    Senior Member aubreyisland's Avatar
    Join Date
    Oct 2005
    Posts
    125
    Member #
    11643
    I don't know if you really care, but with Apache and .htaccess you can make your .js files dynamic!

    If you want to find a way to put in in a js file, Skype me (aubreyisland) and I'm sure we could find a way.

    If not then eh!


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:35 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com