fox said:
Eli said:
No, that's not what I meant.
I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.
Just create a "named" window with window open and submit the form to it
by setting the target to the newly created window name [there actually
*IS* a purpose for the second argument to window.open!]:
<form onsubmit = "return handleSubmit(this)">
....
// the JS:
function
handleSubmit(f)
{
// f => form reference
// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";
// create your named window:
var w = window.open("","myFormWindow","AttributesList");
f.submit();
return false; // or navigate to another page...
}
I tested this in Mozilla with "Block unrequested popup windows" checked
-- and it still worked, but if the user has JS turned off, then this is
toast.. so:
<noscript>
<h3>This site requires JavaScript...</h3>
</noscript>
Or:
<url:
http://jibbering.com/faq/#FAQ4_37 />
Now if you can control the chrome of the new window via JavaScript (because
the user is not overriding your choices) you will control the chrome of the
new window.
If you can not control the chrome of the new window (because JavaScript is
disabled or unavailable), you will most likely still get a new window
because of the target attribute of the <form>.
However, I can configure my browser to ignore both the window.open() and the
target attribute of the <form>, for me, the form would post into the current
window.
The <noscript></noscript> block wouldn't help prevent this because
JavaScript _is_ enabled on my browser, I'm just choosing to ignore you
attempts to open a new window. Using <noscript></noscript> as an alternative
to a script-dependant page (such as one that does <form>.submit()) indicates
a lack of understanding of current browser technology and usage patterns.
There are no longer simply two choices: 1) browser with JavaScript enabled
that you can fully control and 2) brower with no JavaScript
available/enabled.
There are many, many choices: 1) browsers that have JavaScript enabled and
block all new windows with no alternative behaviour (in which case both
window.open() and target would simply fail and the form would be posted with
no response possible), 2) browsers that have JavaScript enabled and allow
new windows, but prevent your choice of chrome (the window may appear a
different size or position than you are expecting), 3) browsers with
JavaScript enabled, but which ignore attempts at both window.open() and
target attributes and open everything in the current window (no new window
ever opens, so if you want to communicate between the opener and the opened
window, you'll have a hard time doing that), etc etc