[whatwg] Cross-document messaging setup on form submit
rich.tibbett at gmail.com
Mon Jan 16 15:12:09 PST 2012
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 .
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  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
More information about the whatwg