I have been working with the TreeWalker. I want to load a page from another domain. I got that working fine. I store window.open() object in a global variable winRef.
Then I would like to walk the nodes and find an anchor that contains "seek/log" in it's href attribute.
Can that be done or is that a security violation and not permitted?
I load the winRef variable like this
I have tried both of the following:
and
each time I get the error "Permission denied".
below is my tree walker code.
Then I would like to walk the nodes and find an anchor that contains "seek/log" in it's href attribute.
Can that be done or is that a security violation and not permitted?
I load the winRef variable like this
Code:
winRef = window.open("http://www.otherSite.com" );
Code:
var rootnode=winRef.document.getElementById("Form1")
var walker=winRef.document.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
Code:
var rootnode=winRef.getElementById("Form1")
var walker=winRef.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
below is my tree walker code.
Code:
function walkTheNodes()
{
//var rootnode=document.getElementById("Form1")
var rootnode=winRef.getElementById("Form1")
var walker=document.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
//Step through and alert all child nodes
while (walker.nextNode())
alert(walker.currentNode.tagName)
var cHref = walker.currentNode;
var cChk = walker.currentNode.href;
var i = walker.currentNode.href.indexOf("seek/log");
if ( i != -1 )
{
alert(walker.currentNode.href);
}else{
alert("Did not find");
}
//Go back to the first child node of the collection and alert it
walker.currentNode=rootnode //reset TreeWalker pointer to point to root node
}
myfilter=function(node){
if ( node.tagName=="A") //filter out INPUT
return NodeFilter.FILTER_ACCEPT
else
return NodeFilter.FILTER_SKIP
}
Comment