Page 1 of 1

submit target new

Posted: Fri Aug 10, 2007 2:00 am
by m2babaey
Hi
when we click a button ( input of submit type) we are redirected to the action page in the same window by default
What code is used and where should we use that code to open the action page in a new window?

Posted: Fri Aug 10, 2007 2:12 am
by John Cartwright
Set the "target" attribute to "_blank" of your form and this should open the results in a new window. I beleive this is non-compliant.. so beware

Posted: Fri Aug 10, 2007 10:11 am
by pickle
Jcart wrote:I beleive this is non-compliant.. so beware
It's non-compliant with XHTML1.1 strict, but 1.0 transitional allows it.

Posted: Fri Aug 10, 2007 11:54 am
by JellyFish
There's always the JavaScript way! :teach:

Posted: Fri Aug 10, 2007 5:07 pm
by VladSun
JellyFish wrote:There's always the JavaScript way! :teach:
JOKING: Also, there is always a pop-up blocker :)

Almost every pop-up blocker blocks pop-ups when there are no user's click (or some other required user's action). But *almost* ... some blockers wouldn't be so kind ;)

While using target _blank I have had no problems.

Posted: Fri Aug 10, 2007 7:42 pm
by JellyFish
Pop ups adds are such a bad idea. Who here thinks that they should have never been used for that purpose?

Posted: Fri Aug 10, 2007 7:55 pm
by VladSun
JellyFish wrote:There's always the JavaScript way! :teach:
Your JS suggestion?

Posted: Fri Aug 10, 2007 9:23 pm
by John Cartwright
window.open :wink:

Posted: Fri Aug 10, 2007 9:26 pm
by VladSun
It is still a pop-up, right ? ;)

Posted: Fri Aug 10, 2007 9:29 pm
by John Cartwright
huh? window.open will open a new window, yes.

Posted: Fri Aug 10, 2007 9:31 pm
by VladSun
...

I mean:

Code: Select all

var E;

try
{
     window.open( ............. );
}
catch (E)
{
     alert("You have a popup blocker!");
}

Posted: Sat Aug 11, 2007 12:25 am
by John Cartwright
Any behavior that emulates a user's action can potentially be blocked. It all really depends on the browser/client your and how they define a popup.