Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relocating A parent page from IFRAME

Status
Not open for further replies.

countdrak

Programmer
Jun 20, 2003
358
US
So I have an iframe in a page.

I load a form in the iframe and once the user hits submit the values are stored in a db and at that point I want to relocate my parent page to a new page.

Any ideas how I would do it after the insert.

Thanks.
 
a child can call functions from within the parent page, and so if you had a function that changes the href of the parent page simply call it from the child.

Though if it's a form being submitted, you woul dneed the server to load the 'target' page which then called the function on the parent page, because if you navigate away from the current parent page, I assume you change the child(Iframe) and may stop the DB being updated.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Can you please give me an example. I cant seem to make it work.
 
what code do you have already?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Maybe I am not calling it correctly.

In my PARENT PAGE I HAVE

Code:
<script language="javascript">

function callme()
	{ window.location.href = 'giftorderprocessed.cfm';}
</script>

A page is iframed in that parent page.

Code:
<iframe scrolling="no" src="[URL unfurl="true"]http://www.mydomain.com/test1.asp"[/URL] align="left" frameborder="0" height="600" width="400" vspace="0" hspace="0"></iframe>

IN MY test1_action.asp page I have my update code and
Code:
ASP UPDATE
<script>
	
	  alert("Successful Update"); 
	  callme();
	</script>

But the alert shows up..the page never relocates! Thanks.
 
You need to talk to the parent...
Code:
parent.callme();
I beleive should do it.


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Did not work. Got an error.

Permission denied. Javascript Error. Using it on IE6
 
well that's will be because the iframe page is on a different domain to the parent page.

you cannot run functions from one domain to another it is called 'cross domain security'.


here is an example showing it works when on the same domain
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Thanks a lot. Two files were in different directories and it wouldnt work!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top