views:

134

answers:

3

I've an old website, navigation in an frame at left, pages at right.

I want when an page is url'd directly the nav (left frame) shows also.

Until now I was an js working, but I don't know from when it are not working, now returns this message:

*Forbidden You don't have permission to access /master.html on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.cpis.es Port 80*

The code I was using is

http://www.webmasterworld.com/forum21/1205.htm

Call this javascript code from the HEAD section of each child page. The code creates a variable from the URL of the page, and then passes that variable in the new location's URL. This means a "master" frameset can load this exact page in the content section: 

<SCRIPT LANGUAGE="JavaScript">
passpage = document.URL 
if (top.location == self.location) 
    top.location.href="master.html?" + passpage 
</script>
Then create just one "master.html" page. It holds the JavaScript code to decipher whatever URL is passed after the "?" and it writes that page into the content frame: 
<html> 
<head> 
<title>Master Frameset</title> 
</head> 
<script language="JavaScript" type="text/javascript"> 
origURL = parent.document.URL 
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length) 
document.write('<frameset cols="20%,80%"><frame src="leftnav.html" name="nav"><frame src="' + contentURL + '" name="content"><\/frameset>') 
</script> 
</html>

Thanks, Guillermo.

+1  A: 

I just checked the website and it seems to be working now. My guess is that there was no file located at http://www.cpis.es/master.html on server.

If the problem still exists please provide steps so we can reproduce it and see what went wrong.

Maiku Mori
A: 

Thanks Maiku Mori,

in order to properly test the problem please do the next:

  • go to www.cpis.es
  • click the second option in the menu (CoPrint)
  • ok, you see the leftnav + the page

now go directly to the page

  • go to www.cpis.es/coprint.htm
  • error, you got the forbidden page.
+1  A: 

Sorry for delay.

Looks like the problem is in this little peace of javascript:

passpage = document.URL 
if (top.location == self.location) 
 top.location.href="master.html?" + passpage

It should be:

passpage = window.location.pathname;
if (top.location == self.location) {
    top.location.href="master.html?" + passpage;
}

You have to change that code in each page which you have in the link list. I think that should fix the problem.

Maiku Mori