Solved

Redirect afer form submit within iframe

Posted on 2006-10-30
6
509 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
[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
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

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!

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

738 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