When a popup is blocked, window.open() returns undefined instead of a reference to the newly created window. This is why you see undefined after the axios.post.
document.getElementById('myButton').addEventListener('click', () => { axios.post(url, formData, { headers: { 'Content-Type': 'application/form-data' } }) .then(res => { window.open("https://javascript.info"); }); });