?
Solved

Redirecting problem

Posted on 2004-08-31
10
Medium Priority
?
593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 600 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
Technology Partners: 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!

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

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

765 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