Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 527
  • Last Modified:

Redirect afer form submit within iframe

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
sweetbuttercup
Asked:
sweetbuttercup
  • 3
  • 2
1 Solution
 
mvan01Commented:
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
 
jessegivyDeveloperCommented:
<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
 
sweetbuttercupAuthor Commented:
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
mvan01Commented:
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
 
sweetbuttercupAuthor Commented:
Thank you anyways
0
 
mvan01Commented:
You are welcome.  Peace and joy.  mvan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now