Hi,
My website is built by frames.
left, right and top
looks abit like that :

____________
____________
    |
    |
    |
__|_________

now lots of the links in the left side, are opened in the right said, and those likns have the option of back to main menu,now i won't those links in the right side that link to the main menu, open in the same window but not in this frame, I mean that the back to main menu won't act only on the right frame, but it will act as if You used "back" in your browser.
now how do I do that??
I know the target="" thing, but I only know "new, right,left" as targets,
can anybody help me?
thx
jc

Dani AI

Generated

Frames load navigation inside themselves by design, so a right-frame page that links back to the main menu or that returns the full frameset after login will stay inside the right frame unless you force top-level navigation. pointed toward history/target approaches; for the simplest, reliable fixes are: set the link/form to load at the top window, or make the page that returns from login detect it is inside a frame and redirect the top window.

Concrete options (pick one that fits your flow):

Use a default top target for every link on the page (put this in the HEAD of the document shown in the right frame):

<head>
  <base target="_top">
</head>

Make the login form submit to the top window (so the resulting page replaces the whole browser, not the frame):

<form action="/member_index.asp" method="post" target="_top"> ... </form>

If you cannot change the form, add a small script on the page returned after login that forces the top window to load that page (avoids nested frames):

if (window.top !== window.self) {
  window.top.location.replace(window.location.href);
}

If a “Back to main menu” link should act on the whole browser history rather than the frame history, invoke the history on the top window (from inside the frame): window.top.history.back().

Caveats: cross-origin frames restrict access to parent objects (assignment of top.location is allowed but many other interactions are blocked). Framesets are deprecated and cause usability and SEO problems — consider migrating to a single-page layout or server-side includes. See MDN for details on window.top and the base element.

Recommended Answers

All 3 Replies

javascript Back Button

<a href='JAVASCRIPT:history.go(-1);'>Back button 1</a>
<a href="JAVASCRIPT:history.back(1)">Back Button 2</a>

php Back button

<a href="<?php echo $_SERVER['php_referer']; ?>">Back</a>

Ok, first of all thanks :)
now,
the back button thing works, but now there is another problem:
there is a link to login in the left, which opens a login sheet on the right, after the user submits his details,he is being referred to member_index.asp , which is all the frames together, again, but with more options ... so what basically happens is frame inside a frame,
so how can I resolve this without opening another window/tab?
thanks in advanced
JC

<a href='member_index.asp ' target = "_top">link</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.