What potential issues can arise when using pop-up blockers with JavaScript-based link generation?

When using pop-up blockers with JavaScript-based link generation, the pop-up may not open as intended due to the blocker blocking the action. To solve this issue, you can detect if the pop-up was blocked and provide an alternative method for the user to access the content, such as displaying a message or redirecting them to a new page.

<script>
    var newWindow = window.open('https://example.com', '_blank');
    if (!newWindow || newWindow.closed || typeof newWindow.closed == 'undefined') {
        // Pop-up was blocked, provide alternative method here
        window.location.href = 'https://example.com/alternative-page';
    }
</script>