Forum Moderators: mack

Message Too Old, No Replies

Question for frames experts

Possible to link to a framed page?

         

nicheman

10:24 pm on Sep 9, 2003 (gmt 0)

10+ Year Member



Let's say my client has a subpage on her framed site that she wants traffic to, say, widgets.html. But if we advertise www.her-domain.com/widgets.html the visitor sees only widgets.html outside the pretty framesets.

Is there a way to configure a URL so that it brings up widgets.html within the frameset?

MonkeeSage

11:05 pm on Sep 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do it with JavaScript fairly easily...

This goes in head of the widgets.html file that is supposed to be shown in a frameset...

<script type="text/javascript">
<!--
if (window.parent.frames.length < 1) {
window.location.hef='path/to/frameset.html';
}
//-->
</script>

Jordan

nicheman

12:32 am on Sep 10, 2003 (gmt 0)

10+ Year Member



Thanks, Jordan.
Now I'm guessing that won't be interpreted as a redirect by spiders?

MonkeeSage

2:54 am on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



nicheman:

AFAIK, no SEs interpret JavaScript yet, so they will just see the frameless page (widgets.html) and basically ignore the JavaScript.

I also might have musunderstood what you wanted to do, exactly. Do you want to not only show the original frameset front page (frameset.html), but also navigate to the document that was being viewed at the time in it's proper frame? That would make sense and others may want to do the same thing at some point, so I'll post an example of one way it could be done.

In the frameset front page head...

<script type="text/javascript">
<!--
function passToFrame(URI, frameName) {
eval("window." + frameName + ".location.href = '" + URI + "'");
}

function loaded() {
if (window.location.search.length > 1) {
var args = window.location.search.substring(1);
args = args.split("+");
var Uri = args[0];
var fN = args[1];
passToFrame(Uri, fN);
}
}

window.onload = loaded;
//-->
</script>

Then in the head of the frameless page to load into the frameset put...

<script type="text/javascript">
<!--
if (window.parent.frames.length < 1) {
window.location.href = 'http://inet/path/to/frameset.html' + '?' + self.location.href + '+' + 'frameName';
}
//-->
</script>

Make http://inet/path/to/frameset.html equal to your frameset page's full URL, and make frameName the name of the frame to load the frameless page into in the frameset page.

Hope it helps!
Jordan

nicheman

2:26 pm on Sep 10, 2003 (gmt 0)

10+ Year Member



So do I understand correctly that the code for the page that declares the framesets does not need to be altered?

nicheman

2:51 pm on Sep 10, 2003 (gmt 0)

10+ Year Member



Do you want to not only show the original frameset front page (frameset.html), but also navigate to the document that was being viewed at the time in it's proper frame?

I think so.
Let me try:
If I browse to [mydomain.com...] I see a page with a top banner and a left navigation bar that remain still when I scroll down on the center part of the site, ie. a framed site. If I click on the "widgets" link on the left navigation bar, then widgets.html loads into the center part of the site, replacing the original page shown there.

However, if I type in the URL [mydomain.com...] it shows widgets.html without the frames. But I want to be able to garner inbound links directly to widgets.html. When a visitor clicks on such a link and comes to widgets.html, I want them to see it loaded into the framesets declared on index.html.

Is that what you thought I meant?
(who invented language, anyway?) ;)

DavidT

3:56 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



You could also use Hal Pawluk's framejammer and/or framestuffer scripts which used to be offered as Dreamweaver extensions on the Macromedia site but no more I think. Just do a Google for the words above. Don't know if it's any better or worse than the method posted above though.