In my safari browser on iPhone 11, I have "block popups" turned off. However with the following line of angular code, I am still getting prompted a pop-up message:
This site is attempting to open pop-up window
Here is the line of code I am using on click:
this.service1.url(this.Method1()).subscribe( response => { window.open('www.google.com', '_blank');} );
What am I missing, or is there a workaround?
This might be occurring if the opening of the new tab isn't the result of a user initiated event, or if there's an async delay after the user event
Details from JavaScript.info
// Most browsers block popups if they are called outside of user-triggered event handlers like onclick.
// For example:
// popup blocked
window.open('https://javascript.info');
// popup allowed
button.onclick = () => {
window.open('https://javascript.info');
};
// This way users are somewhat protected from unwanted popups, but the functionality is not disabled totally.