Specification advises to "redirect the response [of a form] to a hidden HTML iframe", how to achieve this?

StackOverflow https://stackoverflow.com/questions/18588252

Domanda

The CMIS specification says this about the HTTP response to a submitted HTML form:

In general, the response is not useful for an end-user.
Therefore, clients should redirect the response to a hidden HTML iframe.
The iframe’s onLoad event can be used as an operation status notification.

("client" above means a webpage in a browser)

I don't see how it is possible, in HTML, to "redirect the response to a hidden HTML iframe".

The form can not be inside the hidden iframe, as the form needs to be visible. And if the writers had meant to hide the iframe once the form has been submitted, the wording would have been different.

I wonder why they don't recommend ajax instead, but that is not the question. I want to follow their recommendation, or prove them that their recommendation makes no sense.

Can anyone give me an example of such a form that "redirects the response" to an iframe?
Or an example of what the specification was really trying to say?
Or is it just impossible to achieve?

È stato utile?

Soluzione

Ajax only works properly if the application is hosted on the CMIS repository because of the same origin policy. The hidden frame approach works even if the application is served from a different host.

Here is an example:

<script type="text/javascript">
function createCallback() {
  ...
}
</script>

<form action="..." method="POST" target="createResult">
  ...
</form>

<iframe name="createResult" style="display:none;" onload="createCallback()"></iframe>

Here is a complete example: https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings-war/src/main/webapp/web/index.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top