Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Detecting if a style-sheet has loaded?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158389
    mmcgu1966
    Participant

    I don’t know if it’s my connection or just because Im developing, but it’s not unusual for a page to load and consider itself loaded, before the stylesheet has loaded…. meaning no styling, just markup and javascript.

    I came up with a solution, where the last line of the stylesheet gives the BODY tag position: relative and then in the jQuery file, there’s a utility that checks (on document ready) to see of BODY has position: relative. If not, it reloads the page. This works and impressed my client and co-workers (who often try to refresh before the latest stylesheet change has finished uploading), but strikes me as inelegant.

    Has anybody found a more better solution?

    #158395
    __
    Participant

    Checking if a known style has been applied is the only way to know for sure. However, doc ready seems quick to give up. And why reload the whole page—why not just the stylesheet?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.