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

    Join Date
    Mar 2004
    Posts
    4
    Rep Power
    0

    Exclamation Make sure CSS, JS has been downloaded


    Hi,

    I'm looking for a javascript technique that will allow me to check whether all of my external files (CSS, JS, XML) have been successfully downloaded before allowing other scripts to be run in the page.

    I can accomplish this for script files by setting a global variable in the main page and having the external script reset that variable when it is loaded, but I dont know how to do it for CSS files (or others).

    Any ideas?

    W.
  2. #2
  3. 4:04 Time Not Found
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2004
    Location
    Northern Virginia
    Posts
    2,273
    Rep Power
    338
    Put everything in the header, before everything else, the page should automatically render with your stuff included. Unless you're talking about some REALLY huge code.
    I am so smart, I am so smart, S.M.R.T ... I mean S.M.A.R.T.

    Stop Using Pop-Ups
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    4
    Rep Power
    0
    Originally Posted by vbrtrmn
    Put everything in the header, before everything else, the page should automatically render with your stuff included. Unless you're talking about some REALLY huge code.
    Yes the code could be huge (1000+ lines to be used by multiple pages)... and as the web page is acting as a "live" application, I need to be able to know that all files have loaded succesfully and that the user is getting the correct experience.... There must be some way to do this?
  6. #4
  7. HTML/CSS/Photoshop maven
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    CA
    Posts
    184
    Rep Power
    13
    If you're using a server-side scripting language like PHP, you could always "include" or "require" the CSS file in each page. Then it would always get loaded.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    4
    Rep Power
    0
    Thanks for that, but I'm not using php or any host scripts. It needs to be client side only!

IMN logo majestic logo threadwatch logo seochat tools logo