Open link in new tab directly in arrayLink

0

How can I apply the target=_blank attribute directly to the array below?

arrayLink[1]="https://url/cart.php?a=add&pid=00";

I can not apply to HTML.

Follow function executed via onclick:

function buyVps(){
                var vpsDetails='Processor : '+arrayProcessor[sliderValue]+' GHZ'+'\nRAM : '+arrayRam[sliderValue]+' MB'+'\nRAID Storage : '+arrayStorage[sliderValue]+' GB'+'\nMySql Databases : '+arrayMySqlDB[sliderValue]+' GB'+'\nMonthly Price : '+'R$ '+arrayAmount[sliderValue];window.location.href=arrayLink[arrayBlocks[sliderValue]];
            };
    
asked by anonymous 30.08.2018 / 16:15

1 answer

2

window.location.href redirects your local tab to the new url you want. To do what you want, we must use the window.open function. It would look like this:

function buyVps(){
    var vpsDetails='Processor : '+arrayProcessor[sliderValue]+' GHZ'+'\nRAM : '+arrayRam[sliderValue]+' MB'+'\nRAID Storage : '+arrayStorage[sliderValue]+' GB'+'\nMySql Databases : '+arrayMySqlDB[sliderValue]+' GB'+'\nMonthly Price : '+'R$ '+arrayAmount[sliderValue];

    window.open(arrayLink[arrayBlocks[sliderValue]], '_blank');
};
    
30.08.2018 / 16:27