[whatwg] Cross-document messaging setup on form submit

During some experimentation today I wanted to establish a
cross-document messaging channel for when a user submits a form with a
target of _blank (or _someframe). I couldn't find any native way to do
this when target == _blank so I had to produce my own workaround [1].

In the course of doing this I wondered if HTMLFormElement.submit()
could actually just return a WindowProxy object in the same way that
window.open() currently does [2] to grease this whole process.

If the form is blocked - i.e. Event.preventDefault has been called or
the form is running in a sandboxed iframe without 'enable-forms'
permission or some other condition has prevented actual form
submission from happening - then this method would return null. If the
form's target == '_self' then this method could return it's own
WindowProxy to itself, since the current script will simply run to
completion and then get overridden by the new page load anyway.

This change would be backward compatible with all existing web content
and shouldn't affect any existing web pages. So is this a reasonable
addition, are the security considerations manageable and is it
implementable?

br/ Rich

[1] http://fiddle.jshell.net/GZWYE/10/show/light/

[2] http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#dom-open

Received on Monday, 16 January 2012 15:12:09 UTC