Solved

Redirecting problem

Posted on 2004-08-31
10
560 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
Comment Utility
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
Comment Utility
No,

Tried it and it doesn't work
0
 
LVL 5

Assisted Solution

by:cristy56
cristy56 earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Accepted Solution

by:
azcn2503 earned 200 total points
Comment Utility
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
Comment Utility
Sorry guys none of your answers worked
0
 

Author Comment

by:Cyart
Comment Utility
points value is now 400
0
 

Author Comment

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

Expert Comment

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

Cristy
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

763 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

6 Experts available now in Live!

Get 1:1 Help Now