Solved

Redirect afer form submit within iframe

Posted on 2006-10-30
6
504 Views
Last Modified: 2012-06-21
I have a form within an IFRAME.  I have no control of the IFRAMED form.  I need to redirect the user to another page once the user submits the IFRAMED form. In other words, once the "thank you message" is shown in the IFRAMED page, I need to take the user to a different location.  My page containing the IFRAME is a Coldfusion page just in case that helps.  Is there any way to accomplish this redirect?
0
Comment
Question by:sweetbuttercup
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:mvan01
ID: 17836599
Hi SweetButterCup,

I think if the form within your IFRAME is from your domain, you can determine when the "thank you message" is displayed, and redirect.  If it comes from a different domain, I believe you will not be able to query its content.

To redirect your site within javascript, set:
document.location.href = 'yourNextFile.htm';

Peace and joy.  mvan
0
 
LVL 12

Expert Comment

by:jessegivy
ID: 17836644
<form onsubmit="this.parent.document.location='directory/newpage.cfm'">

...you could add the above to simply redirect the page after you've posted to the server.  Have you already satisfied the typical form requirements i.e. uploaded info to server and stored in the database?  If you want them to see the "thank you" message however, you'll need to set a javascript timeout, which would look somethin like this:
function loadPage()
{
     setTimeout("this.parent.document.location='directory/newpage.cfm'",1000)
}
<form onsubmit="loadPage();">

...obviously the form tag would include more than just an onsubmit event but I hope you get the idea?  the 1000 is the number of milliseconds to wait before redirecting the page.  1000 milliseconds==1 second.

Let me know if I'm way off track,

Jesse
0
 
LVL 1

Author Comment

by:sweetbuttercup
ID: 17836703
if the form is in my domain I wouldn't  have any problem to redirect after submit.  I don't have control of the form page.  Is in a different domain and i cannot make changes to it.
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
LVL 11

Accepted Solution

by:
mvan01 earned 500 total points
ID: 17837151
Hi SweetButterCup,

Sorry, the correct answer is, you can not read pages from another domain.
This is somethoing that the browser is not allowed to do, for security reasons.

http:Q_20531959.html
http:Q_21804964.html#16396910

Presuming you knew the url of the "thank you message," you can't even read the url, if it is from another domain:
http:Q_10058491.html

Peace and joy.  mvan
0
 
LVL 1

Author Comment

by:sweetbuttercup
ID: 17844868
Thank you anyways
0
 
LVL 11

Expert Comment

by:mvan01
ID: 17844907
You are welcome.  Peace and joy.  mvan
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 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