www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Firefox doesn't load stylesheets and Javascript in an XHTML 1.1 Page

  1. #1
    Join Date
    May 2005
    Posts
    93

    Javascript and CSS compatibility issues with XHTML 1.1

    I have a page that validates as XHTML 1.1. Currently, I don't have the DOCTYPE or anything set because it won't show up correctly in Firefox. Basically the CSS and the JS don't get loaded at all. The page shows up fine (with the DOCTYPE inserted) in IE6. It's only FF that's giving me the trouble.

    The DOCTYPE I use is:

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    Last edited by vi5in; 06-27-2005 at 03:44 PM. Reason: make the title more descriptive

  2. #2
    Join Date
    May 2005
    Posts
    93
    *removed*
    Last edited by vi5in; 06-25-2005 at 12:37 AM.

  3. #3
    Join Date
    May 2005
    Posts
    93
    I have set up two versions on my server.

    The working version (without the relevant DTD information) is at http://vivin.net and the non-working (with the DTD information, but totally messed up) is at http://vivin.net/sandbox/.

    Thanks in advance!

    adding some info:

    The page loads fine in IE (both sandboxed and normal version). It's FF that's giving me trouble. Basically, I am unable to set any element attributes (like obj.style.left) through Javascript once the DTD is in place. The Javascript seems to be running, but I can't manipulate the objects in the DOM.
    Last edited by vi5in; 06-25-2005 at 12:39 AM.

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    All of your attribute values (99 in total) begin with a white space. Remove them.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  5. #5
    Join Date
    May 2005
    Posts
    93
    No, they don't - that's how Firefox shows it when you do a "view source". I can't figure out why. In my code, I don't have a space before any of the attribute values. Try viewing the source in IE and you won't see a space. I always insert a space between the "=" for readability. So id = "something" as opposed to id="something".
    Last edited by vi5in; 06-25-2005 at 01:19 PM.

  6. #6
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    I thought I had seen this before. (previous thread)
    There is something on the page FF does not like. Try a basic page with minimum content then does work, then add content until it goes wrong again.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  7. #7
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    That is indeed odd. Hmm, might I ask what editor you're using to create your pages? I know programs suchs as MS Word (which is notoriuous for this) insert alien characters. Make sure it's UTF-8 encoding as well, that might be messing up firefox...

  8. #8
    Join Date
    May 2005
    Posts
    93
    Fang,

    Yeah I had posted the thread before, but couldn't find it. I guess I should have used the search function, but I was a little too impatient. I will try your suggestion with a test page.

    MstrBob,

    I send it as UTF-8 encoding (for the charset - the validation page also shows it as utf-8).

    The editor I use is vim (the console version).

  9. #9
    Join Date
    May 2005
    Posts
    93
    Ok, I found an error that was a big deal. In my header, I was setting content-type to text/html instead of application/xhtml+xml (D'OH!!!). When I fixed this, firefox started parsing it as xml (Of course, IE goes WTF?! But screw IE. I'll just send it as text/html to IE). I found a few small parsing errors, and I fixed them, and I thought that it should start displaying, but nope - same problem...
    Last edited by vi5in; 06-25-2005 at 05:54 PM.

  10. #10
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    I know you're telling the browser it's UTF-8 encoding, but is the document actually saved in that encoding? Sometimes weird problems like this can pop-up when you mix up encodings.

  11. #11
    Join Date
    May 2005
    Posts
    93
    Hmm... well, I just save it with vim. vim only does plain-text and doesn't add anything extra.

  12. #12
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Removing the spaces around the '=' does prevent FF from adding a space before attribute values. Bug?
    IE has a problem with the file type, no extension.
    The XML declaration puts IE in quirks mode and is not necessary anyway.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  13. #13
    Join Date
    May 2005
    Posts
    93
    I made a small test page. It shows the exact same problem. What's even more interesting is that only some of the attributes in the style="..." attribute aren't getting parsed. For example, the border-style property is set, but the border-width, and width attributes aren't set. Also, the Javascript reports no value for the width attribute for the div. And just like the other page, I am unable to set any values for the attributes. Fang, I also took your suggestion and removed the spaces - no effect... I can't see what I'm doing wrong at all .
    Last edited by vi5in; 06-26-2005 at 02:58 PM.

  14. #14
    Join Date
    May 2005
    Posts
    93
    *bump*

    Any ideas?

  15. #15
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Property values must have units!
    Code:
    style="border-style:solid; border-width:1px; width:600px;"
    Same for JavaScript:
    Code:
    obj.style.width.value = 200+'px';
    Last edited by Fang; 06-27-2005 at 06:15 AM.
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.41775 seconds
  • Memory Usage 3,005KB
  • Queries Executed 13 (?)
More Information
Template Usage (37):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (15)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (15)postbit
  • (15)postbit_onlinestatus
  • (15)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates