Solved

Redirecting problem

Posted on 2004-08-31
10
576 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML5 save .Dat to server side 20 50
Change Background Color of Website 5 29
Increase the size of the modal in Bootstrap 5 43
html Uncheck Checkbox 2 25
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

856 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