in the <a>
, remove the href
, add `onclick=”go()”, and in a script, add:
function go() {
open("http://www.google.com", "_blank");
location.href = "http://mail.google.com";
}
Good luck!
if you are familiar with event listeners, you could use that instead to call go()
.
I want to open a success page in a new tab after clicking on the download link, but target _blank not working with download attribute. Please Help Me……
Button HTML
<a class="btn download-btn" id="myButton" href="https://www.uiuxstream.com/download/404-error-page-not-found-design-html.html" target="_blank" download>Download</a>
JavaScript
<script type="text/javascript">
document.getElementById("myButton").onclick = function () {
location.href = "/demo/thank-you-for-downloading.php";
};
There’s no need for the _target attribute.