Subscribe opens about:blank

When I click on subscribe on a post that has free public preview it opens up a new tab with about:blank - How can I fix this?
Eg: I Want To Be Free

It’s the code injection footer, where you’re adding event listeners to make events open in a new window. You’ll need to modify the selectors to prevent it from triggering on the portal links.

1 Like

How?

I have this:

<script type="text/javascript">
    var links = document.querySelectorAll('a');
    links.forEach((link) => {
        var a = new RegExp('/' + window.location.host + '/');
        if(!a.test(link.href)) {
            link.addEventListener('click', (event) => {
                event.preventDefault();
                event.stopPropagation();
                window.open(link.href, '_blank');
            });
        }
    });
</script>

Ghost works incorrectly. First of all. Having this code and when I click the subscribe button from the top nav it does not trigger about:blank. It is only triggered on a post with public preview. Second, the reason why I had to add the code is because in a page or post I can’t specify for a button to go open in a new tab. This should be a basic feature to add.

Actually, I 'm not sure this code is the problem, as that button with the problem is set up as a <button>, not <a>

The button-looking thing at the top of the page is actually a link (<a>) element.

I see that script.js (analytics?) is adding an event listener that’s triggered when that button is clicked. You might want to try turning off loading of that script temporarily to see if the problem disappears.

Well I need that analytics, it’s umami. Any other idea how I can solve this?

I wasn’t suggesting you should leave it off, merely that you could identify if it’s the problem by seeing if turning it off makes the problem go away! There’s a lot of stuff going on with that page, and narrowing the problem down might make it easier to know who/where to ask for help.

1 Like

Ok, I see. Well, after taking off that open in new tab script that I posted above the overlay works just fine. So it seems it was that. But that also means all my links that should be open in a new tab now opens in the same window…