function is undefined

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • franks
    New Member
    • Sep 2006
    • 3

    function is undefined

    I built a javascript error reporter into files that I posted to live sites several weeks ago. I've received a few reports in the error log that show that functions defined in a file loaded via the page headers are showing up as undefined. The pages are viewed many times without these troubles occurring, but they sometimes do. It has happened with IE6 and Firefox 1.5 so I don't think the problem is browser specific. I understood that functions loaded through the header would be available for scripts in the body to use, so I do not think that it could be a timing problem or race condition, but maybe I'm wrong on that???

    Has anyone else observed these types of errors? Any ideas as to the cause and possible solutions?
  • pankajit09
    Contributor
    • Dec 2006
    • 296

    #2
    Originally posted by franks
    I built a javascript error reporter into files that I posted to live sites several weeks ago. I've received a few reports in the error log that show that functions defined in a file loaded via the page headers are showing up as undefined. The pages are viewed many times without these troubles occurring, but they sometimes do. It has happened with IE6 and Firefox 1.5 so I don't think the problem is browser specific. I understood that functions loaded through the header would be available for scripts in the body to use, so I do not think that it could be a timing problem or race condition, but maybe I'm wrong on that???

    Has anyone else observed these types of errors? Any ideas as to the cause and possible solutions?

    yes I have observed.

    Whats the solution ?

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #3
      ... do you use iframes or frames that refers functions in other frames through parent or whatever? until loading of html resources always is async there may be problems with that when using different onload events that rely on existence of parents or other frame-sources ... in that case you should ensure that only one (probably the top-frame) is loaded, and when it is ready ... then load the next pages that require code from here. ...

      but this is only an idea until i don't know your application structure ... the above things are common problems ... and may be they are yours too?

      kind regards ...

      Comment

      Working...