I have written a browser extension with crossrider.com, and need to loop through frames on the page using javascript code,
HTML code. (Main.html)
<frameset rows="85,*, 35">
<frame name="header" src="1.html" scrolling="no" frameborder="no" >
<frame name="body" src="2.html" scrolling="auto" frameborder="no">
<frame name="footer" src="3.html" scrolling="no" frameborder="no" >
</frameset>
If I write code on the this page ( Main.html) as
alert(self.frames.length);
it gives me 3, and if I do
for(var k = 0; k < self.frames.length ; k++)
{
var obj = self.frames[k];
// this obj is always object.
//and I could do further operation on this as obj.document ,
}
however If you write crossrider extension and do same as
appAPI.ready(function($){
var framesLength = self.frames.length; //it also gives 3
//but if I do below
for(var k = 0; k < self.frames.length ; k++)
{
var obj = self.frames[k];
// **this obj is always undefined.**
}
});
Any help or direction towards solution is appreciated.
I did raise question to crossrider team. Crossrider-Support-frames-?
The quick answer I got from one of CrossRider employee (Shmueli Ahdut), is that CrossRider API does not support frames however the surprising thing was that
self.frames.length
gave proper alert.
I will be looking into their support for onRequest API with IE. as that way http for frames / ajax request could be monitored easily.