Re: getting current page content (after DOM mutate)
Ash <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
On Jun 17, 5:20 am, Jonas Sicking <[email protected]> wrote: > Ash wrote: > > I may be missing something very obvious here, but: > > > I want to read the current page in Firefox when the page has largely > > been laid out using AJAX/Javascript. Specially I want the current text > > (a la IE's innerText) for page generated by Javascript. > > .textContent is similar (if not identical) to .innerText. > > > Say the current page is my GMail inbox. Now, if I dump > > window.content.document.body.innerHTML, I will only get the static > > HTML as downloaded from GMail which is fairly minimal as its fleshed > > out by later AJAX requests. I don't get the updated HTML/DOM that > > represents the GMail interface including all currently displayed > > messages subjects, labels, etc. (This is just an example, it's not > > only GMail I'm after, it's any page created dynamically on the client > > side) I want the actual contents of the current DOM even if mutated. > > Is this possible? > > .innerHTML (or .textContent) gives you what you want. There is likely > something else that is going wrong. > > / Jonas Hmm. All I do is go to the Javascript Shell (part of the Extension Developer Extension) and set the scope to browser.xul. I then execute, when GMail is the current page: window.content.document.body.innerHTML ... and all I get back is serialised HTML that contains a lot of inline Javascript (which happens to contains much of the contents of my inbox in JSON-type syntax) followed by regular HTML (lots of DIV tags) with no sign of the content I can see on the page beyond the regular static items such as my email address and a link or two. If I explore with the DOM inspector I can indeed see the whole DOM layout of my GMail inbox with all the message subjects and dates, etc. Try it with your gmail and see if you get anything more exciting than me. (Oh and thanks for the .textContent tip)