Solved

Redirecting problem

Posted on 2004-08-31
10
565 Views
Last Modified: 2008-03-04
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
Comment
Question by:Cyart
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 18

Expert Comment

by:CrYpTiC_MauleR
ID: 11946489
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
 

Author Comment

by:Cyart
ID: 11947235
No,

Tried it and it doesn't work
0
 
LVL 5

Assisted Solution

by:cristy56
cristy56 earned 200 total points
ID: 11948265
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
 
LVL 3

Expert Comment

by:azcn2503
ID: 11949854
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
 

Author Comment

by:Cyart
ID: 11958148
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Accepted Solution

by:
azcn2503 earned 200 total points
ID: 11961707
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
 

Author Comment

by:Cyart
ID: 11971138
Sorry guys none of your answers worked
0
 

Author Comment

by:Cyart
ID: 11971140
points value is now 400
0
 

Author Comment

by:Cyart
ID: 11971222
Problem solved, but what do I do with the points?
0
 
LVL 5

Expert Comment

by:cristy56
ID: 11986911
you can split among the experts :) ! or u can ask for a refund from community support too !!

Cristy
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now