Open URL prefilling basic auth

On our lan we have a simple web page with buttons that open various internal sites.

Clicking the button opens the URL in a new tab. This is done using:

var win = window.open('http://' + url, '_blank');
win.focus();

When the new page opens the basic auth popup appears and we have to fill this in and click sign in. Is there any way to populate this using javascript or jquery and click sign in ?

I’ve tried the following, but nothing happened when I clicked the button.

let xhr = new XMLHttpRequest();
xhr.open('get', url, async, username, password)
xhr.send()

Thanks