|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Document Contents - Javascript
Hi all,
Can you used the open() method to open a window with a url, then after that window has fully loaded up use the handle to the new window (on the parent page) in order to read what is being displayed into a variable? I cannot use php to simply get_file_contents due to the circumstances that this is occuring, and DOM will not work as the text I need is not contained in <BODY> tags - it is simply a datadump with no HTML... Anyone have any ideas as although I know how to write to the document property of a window, I cannot seem to find how to read... |
|
#2
|
|||
|
|||
|
RE: Document Contents - Javascript
you sure can....but both of your windows have to have names....just assign the variable to the window object and it should store the contents.
|
|
#3
|
|||
|
|||
|
RE: Document Contents - Javascript
Thank you for your time - this looks like what I need, but cannot get it to work...!
Do you think you could post an quick example? |
|
#4
|
|||
|
|||
|
RE: Document Contents - Javascript
It's okay - I sorted it:
Code:
<html>
<head>
<script>
function checkPage() {
if (dumphdl.document.readyState == 'complete') {
body = dumphdl.document.body;
var children = body.childNodes;
for(var i=0; i<children.length; i++){
document.write(children[i].nodeValue);
}
dumphdl.close();
return;
}
setTimeout('checkPage()',100);
}
var dumphdl = window.open("path_to_page","dump");
checkPage();
</script>
</head>
</html>
In place of the document.write you can write dynamically created <input type=hidden> controls to hold the data, then do a form submit and post back to PHP_SELF in order to grab and manipulate via php... (which is my next job :laugh: ) |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Document Contents - Javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|