?
Solved

check if frame exists

Posted on 2002-07-12
4
Medium Priority
?
2,974 Views
Last Modified: 2012-08-13
I've to reload another frame:
parent.frames[8].location = "page2.htm";
this scripts is included in all my pages with an .js file

But sometimes there's another frameset and the specific frame does not exists. So the scripts should only work when the frame exists

I tried something like:

if (parent.frames[8].name == 'framename')
     {
     parent.frames[8].location = "page2.htm";
     }

But still get an error when there's no frame 8.
0
Comment
Question by:moswa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7148638
var w = window.open("", "framename");
if(w)
{
   alert("frame is present!")
   w.location = "page2.htm"
}
0
 
LVL 1

Author Comment

by:moswa
ID: 7148653
I don't want to use window.open. If there's no frame[8] just don't run the script, not try to create the page.

I had the script working few months ago, but lost the script. Its was something like

if (parent.frames[8].name == 'framename')
    {
    parent.frames[8].location = "page2.htm";
    }

or

if (parent.frames[8]=true)
    {
    parent.frames[8].location = "page2.htm";
    }
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7148724
see above. it does NOT open a window!
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 200 total points
ID: 7148726
if(parent.frames && parent.frames[8] && parent.frames[8].name=="framename")
  parent.frames[8].location="page2.htm";
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question