79378293

Date: 2025-01-22 15:18:59
Score: 1
Natty:
Report link

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");
    });
});
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When a
  • Low reputation (1):
Posted by: web developer