Solved

Redirect afer form submit within iframe

Posted on 2006-10-30
6
493 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now