formtarget ="_blank" not working for button in chrome

439 views Asked by At

I am working on an opencart website, it has a button which should open an invoice in a new tab. When the button is clicked it opens the invoice is new tab as well as the current tab in the chrome. this happens on the page where all the orders are listed, once the admin clicks on the checkbox next to the order and clicks the print invoice button the issue occurs.

it should only open the invoice in the new tab and not the same one as well.

I checked the issue on firefox and it's working properly. i am using opencart 2.3.0.2

here's the code for the button

  <button type="submit" id="button-invoice" form="form-order"
          formaction="admin/index.php?route=sale/order/invoice&amp;token=dummytoken" 
          formtarget="_blank" data-toggle="tooltip" title="" 
          class="btn btn-info" data-original-title="Print Invoice"> 
          <i class="fa fa-print"></i> 
  </button> 
2

There are 2 answers

0
David Chadderton On

Have you tried removing the formtarget=“_blank” ?

More info at https://www.chromestatus.com/feature/6140064063029248

0
Jaydeep Chauhan On

Try something like below that work without any browser restriction.

<form id="form" action="your-action.php" method="post" target="_blank">
     <button type="submit" form="form">Submit</button>
</form>