tags:

views:

425

answers:

4

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.

A: 

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.

Jarod Elliott
Thanks but I have no control over the page in www.abc.com .. I would like to use response.redirect rather than any javascript function.
Shoban
ahh ok. I'm not really familiar asp so i'm not aware of the options using response.redirect
Jarod Elliott
after a quick look around, it appears that this is not possible with asp. It is processed on the server so it's not aware of the frames on the client side. I think you may be stuck using a javascript option in the page itself.
Jarod Elliott
A: 

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

Mudu
yea Matthias.. i want to redirect when I get response from abc.com .....
Shoban
A: 

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)

David Dorward
A: 

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.

AnonJr