Results 1 to 2 of 2

Thread: Target Blank

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Target Blank

    I was testing the following code:

    <form id="test" action="mypage.php" method="post" target="_blank">
    <input type="hidden" value="hello" name="myvar">
    </form>

    Just before the </form>, if i add <input type="submit">, mypage.php opens normally in a new tab. Instead of the submit button, if i do it using js document.getElementById('test').submit(), mypage.php opens in a new window and not in a new tab. Why is that happening? Can i make .submit() open the page in a new tab?

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Target Blank

    In general you have no control over what "_blank" does; it's dependent on the browser and the user's settings. I would likewise also assume that the difference between those two methods is browser-related; have you tried checking this in different browsers?

    You could try having your Javascript execute a click on the submit button (rather than a direct submit()) and see if that makes a difference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width