Thomas 'PointedEars' Lahn wrote:[color=blue]
> askMe wrote:
>[color=green]
> > If I have a frame set of two pages and someone calls one of the[/color][/color]
pages[color=blue][color=green]
> > on its own, a test could be done from the page to see the current
> > parent/top window. If the result is not what is expected, redirect[/color][/color]
to[color=blue][color=green]
> > the parent/top to remake the frameset,[/color]
>
> Child's play. Within the frame document:
>[/color]
Actually, manipulating frames is a pain in the. . . That is why I don't
use them if I don't have to.
[color=blue]
> <head>
> ...
> <script type="text/javascript">
> /**
> * @author
> * (C) 2003, 2004 Thomas Lahn[/color]
<types.js@PointedEars.de>[color=blue]
> * Distributed under the GNU GPL v2 and above.
> * @optional Object|string o
> * Object to be determined an method, i.e. a
> * <code>Function</code> object assigned as property of
> * another object. May also be a string to be evaluated
> * and so is applicable to unknown properties.
> * @return type boolean
> * <code>true</code> if <code>o</code> is a method,
> * <code>false</code> otherwise.
> * @see #isMethodType()
> */
> function isMethod(m)
> {
> var t;
> (m = eval(m)) && (t = typeof m);
> return (t == "function" || t == "object");
> }
>
> if (typeof parent != "undefined"
> && typeof top != "undefined"
> && parent == top // not in a frameset
> && typeof location != "undefined")
> {
> var s = "my_frameset.html?" + encodeURIComponent(location);
> if (isMethod("top.location.replace"))
> {
> top.location.replace(s);
> }
> else
> {
> top.location = s;
> }
> }
> </script>
> ...
> </head>
>
> Within the frameset document:
>
> <head>
> ...
> <meta http-equiv="Content-Script-Type" content="text/javascript">
> ...
> </head>
>
> <frameset ... onload="if (location.search) frames[...].location =
> decodeURIComponent(location.search.replace(/^\??(.*)/, '$1'));" ...>
> ...
> </frameset>
>[color=green]
> > else exit the javascript[/color]
>
> A client-side script in a UA environment cannot be exited. It can[/color]
simply[color=blue]
> be not further executed,[/color]
Exiting is halting/aborting execution.
[color=blue]
> i.e. if no statement or expression follows (or
> the current statement results in a fatal error), the script ends.
>[/color]
It will exit that way, too, although that is not the best way to end a
script.
[color=blue][color=green]
> > and continue loading the current page because the page is already[/color][/color]
loading[color=blue][color=green]
> > as designed.[/color]
>
> See above. Redirection will not be performed if the document is part
> of a frameset.
>[/color]
Hmmm... I don't think that is true. I struggled with a piece of code
recently that required redirection of frames. At one point, it seemed
to work, but I never got any consistent behavior so I ended up
scrapping it. Also, it is possible to refresh the top frame even if
not the subordinates. Of course all the frames can be loaded/reloaded
in response to events, so no major loss if redirection doesn't work.
[color=blue][color=green]
> > Expect the unexpected.[/color]
>
> Learn how to use search engines.
>[/color]
Search to learn engine use why.
http://www.askblax.com
[color=blue]
>
> PointedEars[/color]