View Full Version : Redirect to home page script needed

07-03-2002, 11:07 PM
I run a site that contains pages used by news gathering sites such as Newsnow and Moreover which are in turn used as a newsfeed on other sites.

The problem is that my site uses frames and the pages that Newsnow etc access are seen as individual pages by other users.
That person then reads the page in question and then closes it without ever going to my index page.

So, I'm looking for a script that will send them to my index page (site) when they close the page they are viewing.

I have tried putting a link from each page to my index page but this all depends on that link being clicked.

I have used a snippet of code that does work when the page is seen individually:

<script type='text/javascript'>
function openWindow() {
<body onunLoad="openWindow()">

but when that page is viewed from within the frameset and the user then either uses the back button on the toolbar or clicks on another page on my menu it then opens up my site in a new window and also goes to the page you clicked on in the page that loaded second.

I'm sorry if this seems all a bit long winded and poorly explained but it's the only way I can describe the problem.

I've set up a page on the site to demonstrate the problem.

First click here to go to a stand alone page

Test page (http://www.harriers-online.co.uk/test.html)

Close that window and my site should open up in a new window.
Scroll down the menu to the bottom and click on the test link and the click on one of the links at the top of the menu or on the back button on your toolbar.

This should demonstrate the problem and hopefully help some kind soul to come up with an answer to my question.


07-04-2002, 10:33 AM
Do you want that if a user visits a frame of your page, you want the user to go to the main page in which the frame is located?

I think this should work:

// This script must be used in all your frame pages
var parentSite="http://www.yourMainSite.com"; // Site to redirect
function checkFrame()
// do whatever here

<body onload="checkFrame()">

Is this fine?