• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

Redirecting problem

I have a page that uses an iframe to load another html page (pg1). I have placed a meta redirection on the (pg1) html page so that a different page is called after 3 seconds thus replacing the html page (pg1). This works fine and the new page replaces the (pg1) page, however after a further three seconds the original document (pg1) appears in the iframe, obviously this is not what I intended. The code for the page I have included below I am using XP Pro with IIS 5.1 I am calling the page using the localhost command. Your help would be most appreciated.

<html>

<head>
<meta HTTP-EQUIV="Refresh" Content="5; URL=stocksearch-original.html">
<title>Range Rover Parts Search</title>
</head>

<body  bgcolor="#00293f" text="#f8f6c9" link="yellow" vlink="orange" alink="red">

      <center>
      <font size="3">Sorry the page you are trying to access has been moved.<br> If you are not redirected within 5 seconds click <a href="stocksearch-original.html">here</a>.
      </center>
</body>

</html>
0
Cyart
Asked:
Cyart
  • 5
  • 2
  • 2
  • +1
2 Solutions
 
CrYpTiC_MauleRCommented:
try this replace this...

<meta HTTP-EQUIV="Refresh" Content="5; URL=stocksearch-original.html">

with

<script type='text/javascript'>
if (document.URL.indexOf('stocksearch-original.html') == -1)
window.location = 'stocksearch-original.html';
</script>
0
 
CyartAuthor Commented:
No,

Tried it and it doesn't work
0
 
cristy56Commented:
Try putting this in <head> section in pg1

<script LANGUAGE="JavaScript">
<!--begin
function redirect ()
{ setTimeout("go_now()",3000); }

function go_now()  
 { window.location.href="./stocksearch-original.html"; }

// End -->
</script>

</head>

<body  onload="redirect();">

===============================
Cristy
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
azcn2503Commented:
You want to load up the parent with the new page?

<head>

<script type="text/javascript">
I would recommend trying this script instead (Place it in PG1)
<script type="text/javascript>
function doRedir(newLoc){
setTimeout("parent.location.href=newLoc",secs*1000);
//setTimeout("top.location.href=newLoc",secs*1000);//sets entire window location to the new location
}
</script>

</head>

<body onload="doRedir('stocksearch-original.html',5);">

Hope this helps you. (Just remove the first // and delete the line before it if the code above does not work - please note that the code would do a different thing, but should hopefully serve your needs well)
0
 
CyartAuthor Commented:
Will try both your suggestions. anzn2503 I want the iframe to be populated with the re-directed page. No the whole page being directed with the re-directed page
0
 
azcn2503Commented:
If you are wanting to redirect the IFRAME from the PARENT window (that is holding the IFRAME), use this code instead:
Note that the time out (time in which it takes) is in 1/1000 seconds and is currently set to 5000 (5 seconds).

In the HEAD [id grabber & redirect function]:

<script type="text/javascript">
function grab(objid){
return document.all?document.all[objid]:document.getElementById?document.getElementById(objid):"";
}
function redir(fr,nl){
grab(fr).src=nl;
}
</script>

In the BODY [iframe element & invoke of redirect function]:

<iframe src="about:blank" id="theIframe"></iframe>

<script type="text/javascript">setTimeout("redir('theIframe','http://www.google.com/')",5000);</script>
0
 
CyartAuthor Commented:
Sorry guys none of your answers worked
0
 
CyartAuthor Commented:
points value is now 400
0
 
CyartAuthor Commented:
Problem solved, but what do I do with the points?
0
 
cristy56Commented:
you can split among the experts :) ! or u can ask for a refund from community support too !!

Cristy
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now