• Hello,

    I am having a problem with anchor links behind age gate. This is not a problem when the page has been visited before as folks will not get prompted.

    Example:
    User clicks on a banner ad targeting mysite.com/faq#anchor
    The user gets prompted by age gate and clicks yes.
    The page is displayed, but at the very top of the page — the anchor link is not visited.

    How can I get the anchor to work behind the age gate?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter joegomez17

    (@joegomez17)

    Full disclosure: I’m not a developer. But, I’ve tried something like this in a custom plugin to try and set the window location after the “Yes” click, but the same problem exists. The console echos the hash, but window location is never set.

    (function($){
      $(document).on('agegatepassed', function () {
            let hashjump = location.hash;
            console.log(hashjump);
            window.location.hash = hashjump;
      });
    })(jQuery);

    If I run this manually from the console after the age-gate Yes button, the window is set.

    (function($){
    let hashjump = location.hash;
    console.log(hashjump);
    window.location.hash = hashjump;
    })(jQuery);

    Any help? Its as if the page has to be fully loaded after agegatepassed in order to run the function above.

    Thread Starter joegomez17

    (@joegomez17)

    I had an immediate need for a fix to this, so I hired a developer to create an additional plugin that let anchor links work behind age-gate.

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘jump to anchor after yes prompt’ is closed to new replies.