Detect when page has completed loading without JQuery? Is this possible?
window.onload does not quite seem to do the trick.
My only other idea is to do:
where myfunction goes through DOM tree and detects any changes (well at least element additions - new elements with unknown id's).
What do you guys think?
p.s. I'm reassigning IDs anyway so should be doable...
If you believe you can accomplish your goal using jQuery, why not use it?
Good point. Several questions for you:
Originally Posted by Fang
2) If I use jQuery, does the document.load _ensure_ that the page has completed loading? In other words - if I want to read the DOM structure of the document _once_, can I safely do so after document.load in jQuery, or could there still be changes (_not_ caused by user interaction) that occur as a result?
p.s. Here is my simple idea:
* look at document.getElementsByTagName('*').length every 2 seconds (?)
* if it has not changed - we are done. otherwise, wait again
What do you think?
1) Include the jQuery library in the document.
2) That would depend on what you are doing.
Ok... but I can't control the document. So is (1) still possible? Thank you!
So it's not your site? Please explain what your goal is; we then may be able to help you better.
but I can't control the document
I am working on a Web Automation Framework
in the spirit of WebDriver
using the SWT Browser object
In other words:
i) I have a Java application (on the user's computer)
ii) I am able to do two things from this application:
a) go to some URL
iii) I would like to somehow know when the page has finished loading
My only idea is to:
a) execute: return document.findElementsByTagName('*').length and record value
b) wait two seconds
c) execute: return document.findElementsByTagName('*').length and record value
d) If the value from (c) is different from previous value, goto (b). Otherwise, page has finished loading...
Any other ideas?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)