I have a webpage (say www.xyz.com/a.asp) .. I am having an iframe in this page which loads a page from a different website (www.abc.com/b.asp)... This b.asp asks few questions to the user and the results are posted to c.asp in my website (www.xyz.com/c.asp). This page (www.xyz.com/c.asp) gets loaded in the iframe. Is there any way so that I can reload the entire webpage and redirect to another wbpage when I get the response from www.abc.com. Sorry if this question is confusing, Any queries please let me know.
If i understand correctly i think you might be able to set the target for the post to c.asp to be "_top". This should reload the entire page getting you out of the iframe. Your c.asp page would have to handle the redirection you require.
Alternatively, the redirection that the c.asp page needs to perform may be able to target the "_top" itself, in case you can't change the page which posts the data.
Mhm, not sure if I got you right. Do you really mean when you got the response from abc.com rather than your own web site?
The form tag in HTML seems to have a target-attribute for loading the response to a specified (e.g. _top) target after submitting data:
http://de.selfhtml.org/html/referenz/attribute.htm#form (German)
Not sure if I really answered your question. Did I?
Cheers Matthias
If you have no control over the resource loaded into the frame, you can't redirect using HTTP, so you are stick with JavaScript.
Given the same origin policy, I think the best you can do is to determine when a new document is loaded into the iframe.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<title>test of iframe</title>
<iframe width="500" height="400" src="http://example.net/">
<p><a href="http://example.net/">See The Example Site</a></p>
</iframe>
<script type="text/javascript">
window.onload = function () {
document.getElementsByTagName('iframe')[0].onload = function () {
window.alert('Document loaded in frame');
}
}
</script>
You can then set window.location (possibly after counting the number of times the event fires)
As mentioned above, you can use the "_top" in the target for the form, or you could use some JavaScript on the result page to check and see if its the "top" page. All things being equal, you're better off avoiding the JavaScript as it won't work if the client has scripting disabled.