/    Sign up×
Community /Pin to ProfileBookmark

URL link for specific frame combination

I’ve set up a website using frames. The left side is a menu, the larger right side is the content. The opening page (the “index.htm” file) brings up the menu and a welcome page. Click on one of the menu items and you’re taken to a submenu. Click on an item in the submenu and you’re taken to that content. All this works as expected. Each content has its own HTML page.

What I didn’t expect is, I don’t get a connectible URL with the content; the link remains at the submenu (or menu).

What I want to do is send someone a direct link to a specific menu/content combination. Now I can only take them to a menu and tell them to click on a link.

How do I set up a URL link to a specific frame combination?

Thanks for any help!
Ed

to post a comment
HTML

9 Comments(s)

Copy linkTweet thisAlerts:
@tracknutSep 29.2007 — You don't, which is one reason folks avoid using frames. The menus you're implementing with them would be much better off done with server side includes.

Dave
Copy linkTweet thisAlerts:
@EdBauthorSep 29.2007 — Dave, thanks for the reply.

Is there really no way to link to a specific frame combination? I'm not a web programmer, I'm a writer, and I've spent way too much time developing this page (and not writing) to want to change it again. Ugh!

Looking up "server side includes" I see it takes coding in Apache or somesuch. I'd really like to avoid that if possible.

Any other solutions anybody can think of?

Thanks,

Ed
Copy linkTweet thisAlerts:
@harumphOct 01.2007 — Ok. Here ya go. If you must use frames:

Frameset something like this, 'k?

[CODE]<HTML>

<HEAD>
<TITLE>Frame Page</TITLE>
</HEAD>

<frameset cols="150,*">
<frame name="menu" src="menupage.html" marginheight=8 marginwidth=8
scrolling="auto" target="content">
<frame name="content" src="contentpage.html" marginheight=8 marginwidth=8
scrolling="auto">
</frameset>

</HTML>[/CODE]


Menu Page (menupage.html for our purposes):

[CODE]<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Menu Page </title>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (parent.location.href == self.location.href) {
window.location.href = 'framepage.html';
}
// End -->
</script>

</head>

<body bgcolor="#FFFFFF">
<h3>MENU</h3><br><br>
<a href="contentpage.html" target="content">call content page</a><br>
</body>
</html>[/CODE]


Content Page (contentpage.html for our purposes):

[CODE]<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Content Page #1 </title>

<script language="JavaScript" src="ForceFrames.js"></script>
<script language="JavaScript">
<!--
FrameThem("menupage.html");

//-->
</script>

</head>
<body bgcolor="#FFFFFF">
<h3>CONTENT</h3><br><br>
Content Page
</body>
</html>
[/CODE]


And, finally that little .js file that forces frames (ForceFrames.js):

[CODE]function FrameThem(Menu)
{
// Check to see if (1) this is the topmost frame /* or
if ( top.location == self.location /* || top.location.protocol != self.location.protocol ||
top.location.hostname != self.location.hostname */ )
top.location.replace( 'framepage.html?menu="' + Menu +
'"&content="' + location.pathname + '"' );
}
[/CODE]


What does this do? The script in menupage.html will force it to be opened in the normal frameset if it gets opened by itself. The script in contentpage.html will not only force it to be displayed within your frameset, but will load a menu page of your choosing. I think I got it all covered.

Good Luck.
Copy linkTweet thisAlerts:
@EdBauthorOct 01.2007 — Wow! Thanks so much, Harumph! That is way beyond answering a question. I'd begun investigating rewriting the site, but I'll try your solution first. When I've given it a try later today, I'll report back. --Ed
Copy linkTweet thisAlerts:
@harumphOct 01.2007 — No problem. Good luck.
Copy linkTweet thisAlerts:
@EdBauthorOct 07.2007 — Hey, Harumph, if you're still around and willing to take a look, I finally got to implementing the code you gave me. I'm closer, but not quite there. Although I get a URL, and frames are loaded, I get the default main page, not the current essay. Here are the details:

The JS file (ForceFrames.js):
[CODE]function FrameThem(Menu)
{
// Check to see if (1) this is the topmost frame /* or
if ( top.location == self.location /* || top.location.protocol != self.location.protocol ||
top.location.hostname != self.location.hostname */ )
top.location.replace( 'index.htm?menu="' + Menu +
'"&content="' + location.pathname + '"' );
} [/CODE]


The essay page I'm trying to use as a link (eb_essay_ggate.htm):
[CODE]<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Save the Golden Gate - Ed Brownson</title>
<base target="_self">

<script language="JavaScript" src="ForceFrames.js"></script>
<script language="JavaScript">
<!--
FrameThem("eb_menu.htm");

//-->
</script>

</head>[/CODE]


The code on the main menu page (eb_menu.htm):
[CODE]<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<base target="main">

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (parent.location.href == self.location.href) {
window.location.href = 'index.htm';
}
// End -->
</script>

</head>[/CODE]


The entire frame page (index.htm):
[CODE]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Ed Brownson</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<frameset framespacing="0" border="0" cols="162,*" frameborder="0">
<frame name="content" target="main" src="eb_menu.htm" scrolling="no" noresize marginwidth="0" marginheight="0">
<frame name="main" src="eb_main.htm" target="_self" scrolling="auto" noresize>
<noframes>
<body topmargin="0" leftmargin="0">

<p>This page uses frames, but your browser doesn't support them.</p>

</body>
</noframes>
</frameset>

</html>[/CODE]


I enter this URL:

www.edbrownson.net/eb_essay_ggate.htm

and the resulting URL is:

http://www.edbrownson.net/index.htm?menu=%22eb_menu.htm%22&content=%22/eb_essay_ggate.htm%22

But what I get is exactly what you see at:

www.edbrownson.net

I'm sure I've got some misdirect-redirect issue here but darned if I can find it.

Thanks again for any help.

Ed
Copy linkTweet thisAlerts:
@harumphOct 08.2007 — I tell you what. That script I gave you is pretty convoluted.

Let's just try it this way.

Let's use this for your base frameset:

[CODE]<HTML>
<HEAD>
<TITLE>Canvas</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--

var ar1 = "eb_menu.htm";
var ar2 = "eb_main.htm";

var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}

// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

document.write(
'<FRAMESET COLS="146, *">',
'<FRAME SRC="', ar1, '" NAME="menu">',
'<FRAME SRC="', ar2, '" NAME="content">',
'</FRAMESET>'
);

// -->
</SCRIPT>
</HTML>
[/CODE]


Then, on the top of your eb_essay_ggate.htm page:

[CODE]<SCRIPT LANGUAGE="JavaScript">
<!--

if (top.location.href.indexOf("baseframe.html") == -1)
top.location.href = "baseframe.html?eb_essay_ggate.htm&2";

// -->
</SCRIPT>[/CODE]


Try this.
Copy linkTweet thisAlerts:
@EdBauthorOct 09.2007 — Well, I've tried every combination I can think of of the code you sent. I've changed the variables as seemed logical, then I've changed them randomly to see if that would work. I've put the code in the HEAD, before the HEAD, after. Nothing works.

When the code you gave me is included in the frameset page (ie; index.htm) then it works for the first access only. After that, it generates an error 500.

When I put the code you gave me into the content page, that page is no longer visible, also generating an error 500, no matter how I modify it or don't (what IS "baseframe.htm"? Is it my index.htm file? Some Java keyword?)

The only way out of these errors is to remove all the java code, then of course I'm right back where I started from.

The combination of not knowing what I'm doing with Java and what I call "chemo-brain" (I'm not the sharpest knife in the drawer these days) makes it very difficult for me to puzzle this through. All I can see to do is rewrite the site from scratch. Oh boy.

Harrumph, thanks for your above-and-beyond efforts. The failure is totally mine, not yours.

Still, I gotta say: the last thing I expected to have trouble with in creating a website was generating a simple link to a page! What were the standards guys thinking?

Ed
Copy linkTweet thisAlerts:
@harumphOct 10.2007 — Yes. Baseframe.html is index.htm. Sorry. I should have followed your naming convention.
×

Success!

Help @EdB spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...