Click to See Complete Forum and Search --> : redirect to frame from child window?
Newbie here.
Have searched the forum but can't seem to find anything on this. It may be a Java solution, if so, just point me the right way...
Two related questions:
1) Is there a way to code a redirect into a page that will "sense" if the page is being loaded from a frame or on its own? I have a site full of frames, but have people bookmarking (or bots logging pages onto search engines) as individual pages which really need to be loaded in their parent frame to make any sense. I'm guessing if its possible, it would be with a java script in the basic form of "if not in frame, re-direct to that frame." The concept is to be sure that someone sees the whole frame with the intended page rather than just the "frameless" child window page.
2) Related to #1, is there a way to link (or redirect, as in #1) to a frame but specifying the actual pages to load in the frames *other* than the defaults? I'm thinking something like a "url#bookmark" sort of thing.
Thanks in advance
Here is a link to a thread where I advised on this issue.
http://forums.webdeveloper.com/showthread.php?s=&threadid=1575
Thanks to both of you, works like a charm. :cool:
Too bad I asked this question *AFTER* I went and coded over a thousand files for my site that each now need to have this bit of code added ... :mad: lol
Cheers!
For a site that large, I would think you would be using something like SSI or PHP includes to include all parts of your site, except the content area. Maybe something you should look into...
Heh.:rolleyes: no kidding :p
Probably should be. Problem is, I only know what I know and so I keep doing it. This *is* just a hobby site, (see my user home page if you're interested) not my line of work or source of income. But its grown beyond its britches, so to speak, and I'm at a loss as to what to learn to change the system to accommodate the growth.
What I really need to learn is some form of web based database search/retreive structure. (cgi? )
Some system that would allow me to upload the content itself as something simple like tab delim. text. That would allow me to upload/update pieces of new info for the database (rather than the entire thing for every correction/addition.) But also allow the html to be limited to a few presentation page templates (I like the way the data is presented right now) and let some form of database search engine / result display do all the work.
Currently I'm using FilemakerPro offline to store the data which I'm displaying via all these frames . Ideally, I use a method FMPro supports but its not critical. I could just as easily export the FMP data into another db application more suited to web use. *Definitely* needs to support images associated with data, and really needs to leave a lot of control in my hands as far as web page presentation appearance.
Bottom line tho, I'd *love* to turn the site into a searchable database. It'd be more interactive, more functional (from a user's standpoint), and probably a lot less work for me to keep up to date.
Well. That's my story, and I'm sticking to it. Sorry for the rant. :D
Any suggestions as to where to go from here are certainly welcome. (assuming you read this far without falling asleep or clicking "next thread"...)
Know anything about PHP? It could do wonders for you... :)
Stefan
01-08-2003, 10:54 PM
If you have access to PHP and mySQL on your server I would recoemnd you check out www.phpnuke.org
It's a compleate database driven solution that should get you up and running in not too long.
Well. Ok, then. I get the sense I should look into PHP, although seeing as I know jack about it, it will be with trepidation. But hey! the water always seems cold wne you first jump in...
Thanks for your help. If I go the PHP route, you can bet I'll be back here again ;)
Well, the provided solutions work just fine when its an htm page redirecting itself to a frameset page.
I've got embedded frames (a frameset page called within a frame). The redirect code (of Dave's to #1) doesn't seem to work when its put into a frameset page. I need a frameset page, called on its own (actually, it'll be called open by virtue of a redirect from one of its child pages) to redirect itself into its parent frame. I've effectively need the first redirect into a frameset page (which works) to trigger another redirect into yet another framest page.
It may be some quirk of FrontPage Express 2.0 that keeps dropping the java code down for me unrequested: the java code ends up dropping into the body, *after* the frameset code of the frameset no matter where I code it using the "view htm" dialog. As a result, with the code below the frameset, it seems to not try to re-direct.
BTW: I get the same basic "push the java out of the <head>" when I go to work on the receiving frame code for the function definitions per Dave's #2.
I know, I know. Use PHP. ;) But in the meantime, I gotta get this to work...
no matter how I code it in to FP Exp., this is what it results in when I work the frameset page redirect code:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>A Genesis Discography - Gabriel : Peter Gabriel - ("Security") (frame)</title>
</head>
<frameset rows="45,*" border="0" frameborder="0noshade">
<frame src="PG4securityTitle.htm" name="heading"
marginwidth="0" marginheight="0" scrolling="No" noresize
border="0" frameborder="0">
<frameset cols="*,420" border="0" frameborder="0noshade">
<frame src="PG4securityCat.htm" name="catalog"
marginwidth="5" marginheight="0" scrolling="Auto"
noresize border="0" frameborder="0">
<frame src="PG4securityDet.htm" name="display"
marginwidth="0" marginheight="0" scrolling="Auto"
noresize border=" 0" frameborder="0">
</frameset>
<noframes>
<body bgcolor="#AF9A50" text="#282822" link="#515141"
vlink="#515141" alink="#515141" bgproperties="fixed" nosave>
<script language="javascript">
if (top == self) {
top.location.href = "PGalbumframe.htm?url="+self.location.href;
}
</script><p> </p>
</body>
</noframes>
</frameset>
</html>
Well, Dave. This is where your patience with me may be getting taxed. I appreciate your help so far. If you've had it, just say so :)
I've gotten around the FPexp.2 bug issue. The re-direct from frame to frame now works in that it calls the frameset page. What doesn't work is passing the referencing file name for loading into the new frameset.
In the reference frameset page I've got your code (see below) and have tried various names for "mainFrameName" with absolutely no success (what should that be the name of the frame to load into?). All I get when opening this page, either as a redirect or directly is a javascript error and blank white field in the frame where the redirect file should be opening. The default doesn't make in there, so it seems like its failing in the functions. I can't figure out how to get it to describe the error for me either.
PS: I have also pursued Pyro's code, and that gets the frameset opened with the redirecting frame loaded in the right place. However, it only works with IE (v.5) and crashes my Netscape Communcator 4.72. I also have one more re-direct to go from there up into one more higher level frameset and when I go for that redirect it fails to load anything (either default or redirecting frameset) into the frame where the 2nd generation back redirect used to load ok. Seems like Pyro's code won't pass a redirecting filename from more than one generation back.
Sorry if I'm being dense about something...
code:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>A Genesis Discography - Gabriel Albums Frame</title>
<script language="javascript">
function loadFrame(tgt) {
var QueryString = new SearchStringExtract(top.location);
if (QueryString[url]) {
tgt.location.href = QueryString[url];
} else {
tgt.location.href = "Select.htm";
}
return true;
}
function SearchStringExtract(locObj) {
var i, inpt = locObj.search.substr(1);
if (inpt.length > 0) {
var ary = inpt.replace(/\+/g, " ").split("&");
for (i in ary) {
ary[i] = ary[i].split("=");
this[unescape(ary[i][0])] = unescape(ary[i][1]);
}
}
}
</script>
</head>
<frameset cols="150,*" border="0" frameborder="0noshade" onLoad="return loadFrame(top.frames['mainFrameName']);" >
<frame src="PGlistalbums.htm" name="list" marginwidth="5"
marginheight="0" scrolling="Auto" noresize border="0"
frameborder="0">
<frame src="about:blank" name="details" marginwidth="0"
marginheight="0" scrolling="No" noresize border="0"
frameborder="0">
<noframes>
<body text="#282822" link="#515141" vlink="#515141"
alink="#515141" bgproperties="fixed" nosave>
<p>This page requires frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>
Thanks for the effort Dave.
I tried the name of the frame ('details' in this case) with single quotes, without, with double quotes, without brackets, with a cherry on top... none work. I even went back and started all over from scratch. The only time I think I might actually have it right is the time when Netscape repeatedly and inexplicably crashes. Something is obviously not right somewhere.
I'd love to figure this out (I hate leaving a puzzle unsolved), but am begin to think its not worth it: While its pretty obvious that if I have a starting page that redirects to a frame and passes itself to that frame to load instead of the default, that'll work, I'm beginning to suspect that when *that* frame redirects itself up further to another, giving itself as the passed filename, the original passed filename of the starting page is lost and while the next frameset will load the redirecting non-default framepage into the appropriate frame, it will load it with that frameset's own defaults, not with the original redirecting (non-default) page that started the process in the first place. Does that sound like a correct prediction of the code routine outcome if I nest several frame re-directs? If so, it loses the effect I was looking to achieve to begin with and I might as well just make the redirect from the initial page right to the top frameset and forget about passing filenames.
Which *is* still better than I had before you guys helped me out :D thanks!