in my page i need to use link so when the user click it a new tab will open and the old tab should be redirect to another URL i try this code but does not work
<a class="aaf" href="www.abc.com" target="_blank"></a>
i use class with the a tag and this is my script
$('.aaf').on("click",function(){
window.location.replace("http://stackoverflow.com");
})
To solve it, you need to add setTimeout to function like this.
function changeLocation (){
setTimeout(function(){
window.location.replace("http://stackoverflow.com");
},200);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.