PDA

View Full Version : redirecting to new frames webpages



suehue
03-04-2006, 03:54 PM
I know the answer to this is simple, and I may be using the wrong term for what I want to do. I redid a web page and put it in frames (don't ask me why) and now the people who had created a shortcut to a page (such as the monthly calendar) still get that page sans the top and side menu. Is there a way to have them go to the frames page if they use one of these links they already have??

example, the site is www.saintjohnlutheran.net but people have www.saintjohnlutheran.net/1_calendar.html as a shortcut and only get that page.

Sigh, I am glad I do not do this for a living. Too intense.

Thanks in advance for any input - Susan

jscheuer1
03-04-2006, 04:29 PM
I don't think that is so simple, breaking your page out of frames is easy enough but, putting it into one if it is not already there is quite another matter. You can easily detect if the page isn't in the frameset but, unless you have a separate frameset for each 'orphan' page that you can redirect to, you need a way to tell the one frameset that you do have to load in that particular 'orphan' page. Another approach would be to use the frame detection method to provide a link back to home:


<script type="text/javascript">
if (top.location == location)
document.write('<a href="http://www.saintjohnlutheran.net/">Home</a>')
</script>

Put this someplace in the body of each of your pages that might appear outside of the frame. Put it someplace where the user will see it and click on it if they want to continue with the site. It will only write the link if the page appears out of the frame.

suehue
03-04-2006, 04:56 PM
John,

Thank you for the quick response. I will try your "home" idea, I think it will work. Some of the people who use the site are not so computer savvy, but would click on a "home" link if confronted with no menu for further navigation.

Again, thank you. Susan

jscheuer1
03-04-2006, 06:09 PM
Oh, you're welcome. Out of curiosity and because I remembered a similar case, I looked this up in the archives:

http://www.dynamicdrive.com/forums/showthread.php?t=2354

In that thread was developed a method for 'enframing' these orphan pages. I would probably write it differently now and, it will not work on some server/framesets combos due to not being coded to work in all such situations but it worked for the OP in that case and might for you. What it boiled down to was putting this script in the head of each page that might become 'orphaned':


<script type="text/javascript">
if (window == top) {
var url='window.location.replace("http://www.saintjohnlutheran.net/?var1='+window.location.href+'")';
eval(url);
}
</script>

You might need the actual name of the frameset page, like 'index.html' right before the ?.

Then on the frameset page, have this code in the head:


<script type="text/javascript">
var text = window.location.href;
function delineate(str) {
theleft = str.indexOf("=") + 1;
theright = str.indexOf("&");
return(str.substring(theleft, str.length));
}
url=delineate(text)

function refreshFrame() {
if(window.location!=url)
frames['mainFrame'].window.location.replace(url);
}
</script>

Where mainFrame is the name of the frame you want the 'orphan' to appear in.

Finally add this to the frameset tag:


<frameset onload="refreshFrame();" rows="160,*" cols="*" framespacing="0" frameborder="no" border="0">

suehue
03-04-2006, 09:10 PM
The first response does not seem to do anything. BTW, am I nuts to put this in frames??? All I wanted was a static side and top, and not being very good at all this, was the only way I could figure it out. I keep the site simple as I have a bunch of grey haired old ladies accessing it when they "snowbird" it to Fla or Arizona every winter, and it is their lifeline to their church.

I like the HVMenu and the ones that "jump" down the sides while you scroll annoy me, and I thought the pages would load faster with the top graphic already in place. Sigh.

Will try your second option, and thanks again. Susan

jscheuer1
03-04-2006, 09:35 PM
If you are having problems with the first method, the second may be more of a problem. Where did you put:


<script type="text/javascript">
if (top.location == location)
document.write('<a href="http://www.saintjohnlutheran.net/">Home</a>')
</script>

on your page? Do you have javascript enabled? Did you view the page outside of the frameset (the script will do nothing if the page is viewed through the frameset)?

suehue
03-05-2006, 12:04 AM
OK, when I moved it up in the body to just underneath the "body onload" for the menu, then it worked. I think this will be an ok alternative for the people using the pages until they make new shortcuts. Thank you.

I must have had it down to far. I am using a old javascript for the calendar page and tried to put it after the code for this and before the calendar table. I am grateful for so much help.

Susan

suehue
03-05-2006, 01:29 PM
John, you never answered my question. Do you think frames was a bad idea? I get a lot of conflicting opinions about frames, and am not sure what the bad rap is all about. Will my pages being in frames cause anyone coming to the site any angst??? Thanks if you can enlighten me about this. Susan

jscheuer1
03-05-2006, 02:09 PM
You will get various opinions on that. Generally, I would say there is no problem.

There was a time when many browsers could not display them, this is no longer true, though there are some older ones out there that cannot and folks with special browsers to suit handicaps like blindness, etc. may have trouble navigating or even 'viewing' them properly.

Also, if someone bookmarks a page from your site that is in a frame, it is the frame's address that will be saved. This means that upon activating the bookmark, the person will go to the main page of the site, not the specific page that was showing at the time they bookmarked it. I tend to avoid using frames for the main portions of a site for this reason, reserving them for special organizational or visual effects in things like galleries, etc.

Indexing sites like Google may have trouble properly indexing your site if you use frames, I have no definitive knowledge as regards this. It was surely true at one time but, may no longer be.

Feedback from your target audience is the only reliable way to judge if any particular use of frames is or is not appropriate to your content.

The safest method is simply to avoid them though.

suehue
03-05-2006, 02:46 PM
Thank you. These are things I will consider while deciding whether to keep this format or change it down the road. I like to redesign the pages about every year and a half to keep it fresh so this version is not carved in stone.

The pages shown in the "home" section of the pages are essentially the same ones displayed in the last version (non-frames) and I did not rename them, way too much trouble to edit all the links, etc. I do most in tables in percents to fit in most resolutions without horizontally scrolling. I try to use the KISS principle to keep problems to a minimum since I am not code savvy.

I appreciate this forum and esp all your help. I cannot thank you enough.

Susan