Reputation: 2241
In my app (with alpinejs 3 ) I have texarea with several urls entered(any url on any new line) and I try to open any url in new tab of my browser:
let arr = content_textarea.split( String.fromCharCode(10) );
let l= arr.length
// let windowFeatures = "left=100,top=100,width=320,height=320";
for (let i= 0; i< l; i++) {
console.log('arr[i]::')
console.log(arr[i])
// window.open(arr[i], '_blank', windowFeatures ); // Uncommenting this line did not
window.open(arr[i], '_blank' );
// delay(1000); // Uncommenting this line did not
console.log('NEXT::')
}
But only 1st link is opened actually. In browsers console I see output of all lines. If there is a way to OPEN ANY url in separate browsers tab ?
I tried Google Chrome Version 100.0.4896.75 under kubuntu 20.
Upvotes: 1
Views: 255
Reputation: 798
Try this:
let arr = content_textarea.split( String.fromCharCode(10) );
let l= arr.length
for (let i= 0; i< l; i++) {
window.open(arr[i], i);
}
Upvotes: 1