I am making a site called

The question I have is this.

When a user visits my site evrything is done from the main page and the pages they visit change through frames.
They never actually leave the index page.


The problem I am having is the history. It is showing all pages they visited with me and of course if they choose to click one of them it will not take them back to index, it will take them directly to that page that should be appearing within the frame on the index page.

How do I adjust these pages so they will either show up in history only as or even better is there a way to make them NOT add themselves to the users browser history at all.

Desperate in ottawa.

Snapped

Dani AI

Generated

Frames and the browser history are the root of this behaviour. describes the classic frameset problem: inner pages get recorded as visited URLs and, when selected from the browser history, load on their own instead of restoring the framed UI. and point to parameter/redirect workarounds and is right to warn about changing history — users expect the back button to work.

A cleaner, modern fix is to stop using frames and manage navigation in one top-level document. Use the HTML5 History API to map UI states to real URLs and to control whether a navigation creates a new history entry or replaces the current one. Example pattern:

history.pushState({view: 'details'}, 'Details', '/details');
history.replaceState({view: 'home'}, 'Home', '/');
window.addEventListener('popstate', function(e) {
  // read e.state and render the matching UI
});

If frames are unavoidable, the parent page (only when same-origin with the framed document) must be the one to manage history — child documents cannot reliably suppress entries on their own across browsers. Also make sure direct visits to any state/URL render the correct UI (server-side routing or redirects), and use a canonical link to avoid duplicate-index issues.

For design and discoverability, prefer SPA/AJAX + History API over frames. See the History API docs and the note that framesets are obsolete for background reading: History.pushState, popstate event, frameset element (deprecated), and JavaScript SEO basics for server fallbacks (Google Developers).

Recommended Answers

All 3 Replies

That is a limitation of frames. You can use a parameter for the page being loaded in the frame so history will cache that way. www.website.com?param=someothersite.com

In the "not index" pages

<script type='text/javascript'>
if (self.location == top.location) { self.location='/index.html?frame=' + self.location;
</script>

in the index page a reference to set the frame src to the 'frame' parameter if set, or to the home page if not set

//my scripting isnt this good
if (frame != "") {document.getElementbyID('frame').src= frame;}

Or in php asp the same can be done serverside and never serve the pages outside of the frameset

<frameset bgcolor="#eeeeee" rows="120,0" frameborder="0" bordercolor="#eeeeee">
<frame name="Header" src="/head.html" frameborder="0" title="Header" scrolling="no" noresize>
<?php If ($frame)
{Echo '<frame name="Details" src="/' , $frame , '" frameborder="0" title="Details" Scrolling="auto" Noresize>';
}
else
{Echo '<frame name="Details" src="/home.html" frameborder="0" title="Details" Scrolling="auto" Noresize>';
}
?>
</frameset>

I hate it when people mess with the history, because I often want to return to the page I came from before I visited that page.

DO NOT change the history. You are affecting things not connected with your site.

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.