When does script added to the page with Page.ClientScript.RegisterStartupScript() actually run? MSDN states "when the page finishes loading but before the page’s OnLoad
event is raised" but this isn’t much detail.
For example, can a script added with RegisterStartupScript
assume the DOM tree has been built? Does the behaviour differ between different browser implementations and how?
The startup scripts are added to the bottom of the markup. So they are processed automatically as the markup loads. I guess the exact implementation of this depends on the browser.
The DOM tree should be built when the startup scripts are executed.