alan22 — 2011-05-09T11:19:35-04:00 — #1
I was wondering if is it possible to prevent a form in iframe submitting to it's _parent page and force it to submit to iframe instead?
Please see my example below:
Content of page 1
<iframe src="http://server-b/form.html" width="450" height="500">
<p>Your browser does not support iframes.</p>
<form action="http://server-a/landing.cgi" target="_parent">
<input type="hidden" name="field1" value="val1" />
<input type="submit" value="Submit" />
paul_wilkins — 2011-05-09T23:11:02-04:00 — #2
Could you give a name to the iframe, and give that name to the target attribute? No scripting required, or needed even.
alan22 — 2011-05-10T01:24:31-04:00 — #3
Hi Paul, many thanks for your reply.
Unfortunately I have no control over http://server-b/form.html
I can only manage http://server-a/...
So my idea was to use 'onbeforeunload' or similar to solve this problem. Not sure how this could be exactly done though.
paul_wilkins — 2011-05-10T02:55:21-04:00 — #4
onbeforeunload only allow you to show a message to the user, where they can choose to stay on the page or allow the new page to load.
For an example, see: onbeforeunload Demo
I don't think that web browsers allow you to have the control that you seem to need, over an iframe from another domain.