# How to test for a frame loaded in javascript?



## billbush (Nov 25, 2004)

I'm doing a site with 3 frames. Yes I know frames suck  Let's call them frame1, frame2, and frame3 going from top to bottom... Search engines will list all 3 of them... I am trying to figure out a little script that would go in the pages for frame1 and frame2 that tests to make sure the right filename is loaded in frame3 and if not then load the index.html file... I am familiar with test to see if self==top to force frames, but i need to see if a particular file is loaded in a particular frame name... Thanks in advance for any help you js guru's out there can give me!


----------



## Shadow2531 (Apr 30, 2001)

Do you mean something like the following?


```
if (window.frames[2].location != "blabla/frame3.html") {
        window.frames[2].location != "blabla/frame3.html";
    }
```
frames[2] would be the 3rd frame.

I didn't test that. Just wondering if that's what you mean.


----------

