Input button target="_blank" isn't causing the link to load in a new window/tab

Teemu Laine picture Teemu Laine · Jun 20, 2013 · Viewed 134.4k times · Source

I have an HTML file with an input button. This is only an example button, but it's including all necessary info of code:

<input type="button" onClick="parent.location='http://www.facebook.com/'" value="facebook" target="_blank">

For some reason, it's not loading in a new window/tab.

Answer

mans picture mans · Jan 9, 2014

use formtarget="_blank" its working for me

<input type="button" onClick="parent.location='http://www.facebook.com/'" value="facebook" formtarget="_blank">

Browser compatibility: from caniuse.com
IE: 10+ | Edge: 12+ | Firefox: 4+ | Chrome: 15+ | Safari/iOS: 5.1+ | Android: 4+