Forum Moderators: open

Message Too Old, No Replies

Using frames, need to trap user landing on frame.

How to do it?

         

fischermx

2:33 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a site which uses frames.
Some times, a user may find a page in search engines and land to that page directly, not the one with the frameset.
Is there a trick with javascript to redirect this user(on client side), so that he/she see the website as it was designed, instead of a single page?

kevinjohn

3:55 am on Jun 14, 2005 (gmt 0)

10+ Year Member



Do you want the new page(from another site) to be displayed in your frameset and not as a new web page?

jimbeetle

4:00 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A search for 'dynamic frameset' should turn up a few solutions that basically force the "content" page to be shown in it's parent frameset. At one time I used a very sophisticated one from Netscape's DevEdge, not sure if that is still available. Others are a bit simplet but will still get the job done.

fischermx

4:03 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Do you want the new page(from another site) to be displayed in your frameset and not as a new web page?

No, I'm not talking on how to avoid frame breakers.
It's all my content in my site.

RonPK

6:47 am on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See also [webmasterworld.com...]

fischermx

2:52 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice, so the code is this :

<script language="javascript" type="text/javascript">
if (top.frames.length==0) {
document.location= "default.aspx";
}
</script>

Just put that in the head of each of the framed pages and when visited individually they'll redirect to the frameset page ... Nice :)

RonPK

3:24 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's not the right way to welcome your visitors: they find relevant information in a SE, click the link, and get redirected to your homepage. They will then need to start searching for the right page all over again.

The idea is to stick the 'orphaned' page into the frameset, and that's what the script in the other thread does.

fischermx

3:41 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RonPK:
I don't understand what you mean, but I'd like to.
Could you explain a little further?
I mean, what do you mean to stick the orphaned frame?

See, I have the main page, default.aspx, which has also, top.aspx, right.aspx, and left.aspx.
"Top" and "Left" are non-content pages but are crucial to the site functionality, actually they are the site functionality.
However, I have text con "Right.aspx", sometimes people land on "right.aspx" and they wonder what the hell is my site about, since they don't see it as I designed it.
So, the people landing on any of this frames needs to be redirected to see the site in the way it is supposed to work.

RonPK

4:14 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Suppose visitor Joe finds your page somepage.html with a search engine. You then want to show Joe a frameset with top.aspx, left.aspx and somepage.html. If you only use the piece of script in msg # 6, Joe will be shown the default frameset: top, left and right.aspx.

All of this is irrelevant if your site only consists of top, left, and right.aspx - which seems unlikely.

rocknbil

5:57 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Some times, a user may find a page in search engines and land to that page directly, not the one with the frameset.

IMO this one's one of the top ten reasons NOT to use frames on a website. Look at what you're trying to do: you're looking for a Javascript fix for something that is **probably** best done on a more fundamental level: rebuild the pages without frames.

I've been doing this about 10 years (not "bragging," this is just to demonstrate the course of time I've been watching) and have only encountered two situations (so far) where you can't completely dispense with frames.* Anything that motivates you to use frames can be implemented in a single page using server-side includes, Javascript, or any of a dozen other ways.

Understand this is not a flaming of your technique, but the best course (IMO) you can take to address this problem - I know what a pain it is to revise an entire site and route out the frame-monster, but believe me - IT'S WORTH IT! :-D Your pages will be lighter, you'll move closer to standards, and all of your indexed pages will have NAVIGATION.

On that one - I doubt you'll lose anything if you keep the framed pages the same name. That is, if the one that comes up on the search engines is mypage.html, if you leave that name and just put the content that's in other frames in it - this will actually enhance your SEO as the search engine will read it as changed, new, and reindex it.

- signed, ex-frameaholic.

* 1- when you need to display a page that you have no control over, such as an external site, and wish to keep your on-site navigation intact, or 2 - when you want to dynamically write to a frame document with Javascript, for something like a price calculator. Even #2 has better single-page alternatives with modern browsers.

fischermx

6:11 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you know a site that offers "urlinfo", from a guy called "fagan"?
Please, take a look. My site offer very similar functionality, though, different services, so, frames is 100% what I need ... or not?