anchoramp-htmlpage-refreshgoogle-amp

Anchor tag in AMP page reloads entire page


I have the following hyperlink on an AMP page, it's a link to an anchor further down on the page:

<a href="https://www.example.com/venues/amp#party">party</a>

The anchor tag is present too: <a name="party"></a>

Now when the user is on URL https://www.example.com/venues/amp and clicks the hyperlink, the entire page reloads and shows https://www.example.com/venues/amp#party

I don't want the page to reload, I just want to jump to the anchor tag like in a regular web page, so why is this happening? Testing Chrome on Windows 10.


Solution

  • Change the following

    <a href="https://www.example.com/venues/amp#party">party</a> 
    

    to

    <span role="button" tabindex="0" on="tap:customId.scrollTo(duration=500, position=top)"> Go to Target </span>
    

    and

    <a name="party"></a>
    

    to

     <span id="customId"></span>
    

    Click here for example

    For more information Click Here