From: Dave K. <dko...@ve...> - 2005-04-26 23:46:08
|
This may well be beyond the intended functionality scope of HTMLUnit, so do feel free to tell me to bugger off... I've been having some trouble with a page with javascript - the functionality contained in the javascript seems to not be working when run with htmlunit. In particular, an onload() function set in the javascript does not execute. The code in question (and I must emphasize that this isn't my code, but rather code inserted by a 3rd-party software utility to do performance monitoring of web pages) works as follows: Javascript in the original html page does a document.write() to bring in 2 files from the web server containing additional javascript code. That javascript code in turn gathers a bunch of data then does another document.write() to insert more javascript code into the page. That second document.write() adds function definitions for window.load() and window.unload(). It seems that as long as the onload function is defined in javascript in the original html page, the function gets executed fine. However, with the onload function being set as a result of the code added via document.write(), it does not get executed. Tracing the call to executeOnLoadHandlersIfNeeded shows that, at the time it is called, the onload function has not yet been defined. So I guess my question is, would this be considered a bug (since the behavior differs from that in a browser)? Or is such functionality beyond the current scope of the software? Thanks for all the help so far. Dave |