PDA

View Full Version : Redirect to a target frame?



Jack
09-09-2006, 06:26 PM
My wife and I are using frame on our site and I had a script a while back that would load the “content.html” page should the user enter by some other page.

For example:

If someone had entered our site via www.domain.com/main.html the script would also load the “content.html” page. The “content.html” page is our navigation page.

I’ve been looking around but can’t find what I’m looking for. Can someone help?

Thanks…

mburt
09-09-2006, 07:15 PM
That's one of the downfalls of frames :)

It all rides on the index.html (or whatever the frames page is)

Jack
09-09-2006, 09:27 PM
That's one of the downfalls of frames :)

It all rides on the index.html (or whatever the frames page is)

Yea I know, that's why I have to find that little script. Should I find it I'll be sure to post it for others.

mburt
09-09-2006, 09:38 PM
Unless there's a way to read the page without reading it inside the frame, I don't see it being possible.

Twey
09-09-2006, 09:42 PM
if(window.top != window) window.location.href = "/";How's that?

mburt
09-09-2006, 11:39 PM
Ah. *snaps fingers
I never thought of that.... :)

But just a question: Why don't you use braces?

Twey
09-09-2006, 11:45 PM
But just a question: Why don't you use braces?Because I don't like them. :)

In a lot of cases, they add no readability at all, and just waste space. In fact, I find code with excessive amounts of braces scattered throughout it a lot harder to read than code with braces only where necessary. Also, with a single statement it makes more sense to me to read the whole line, if, expression, and statement, as a single statement, rather than mucking about with braces and ruining the flow of the code.

Tastes may differ.

mburt
09-09-2006, 11:52 PM
I agree. To a point :p. I find braces help me read the code, but comparing code to actual languages, I think without the braces, would make it more like our own languages.

Twey
09-09-2006, 11:56 PM
The only time I find braces help me to read the code is when I have complex nested if/else statements such as:
if(cond1)
if(cond2)
if(cond3)
doSomething();
else if(cond4)
if(cond5)
doSomethingElse();
else doSomething2();
else doSomething3();
else doSomething4();Even that's not too tricky to read when indentation is used properly.

Jack
09-10-2006, 02:13 AM
if(window.top != window) window.location.href = "/";How's that?

I'm sorry Twey but I don't know what to do with that. I don't write codes so unless you tell me what I need to add to it, it's not going to be useful to me. Also, does it go in the head or body of my page?

A little more help please... :cool:

Twey
09-10-2006, 01:10 PM
so unless you tell me what I need to add to it, it's not going to be useful to me.Nothing, nada, zippo, zilch, rien, 何も. :) Just stick it in a <script> block somewhere on your page.
Also, does it go in the head or body of my page?Doesn't matter.