Can't link to anchors from emails

Level 10 - Community Moderator

Re: Can't link to anchors from emails

Yes, I am sure.

Alas. You’re right, bug still exists.


You can put the JS in the <head> (note I wouldn’t use this exact code anymore, but it still works):

document.addEventListener("DOMContentLoaded", function(e) {
  let scrollToSelector = getURLParameter("scrollTo");
  if(scrollToSelector) {
    let scrollToElement = document.querySelector(scrollToSelector);
    scrollToElement && scrollToElement.scrollIntoView();

   * @see [IOWA Util]
  function getURLParameter(param) {
    if (! return;

    var m = new RegExp(param + '=([^&]*)').exec(;
    if (!m) return;    

    return decodeURIComponent(m[1]);


Then encode the hash in the query string:


That’ll have the same effect as:

(or close enough that the diff is negligible)

Level 4

Re: Can't link to anchors from emails

Hi @SanfordWhiteman  - Just found your latest post. I've asked them to put the (latest) script you sent in the <head>. Once that's done, is there something they need to do to label the section that they might not be doing? And is the "%23" in your link example required? To be very specific, this is the page:


And the content they are trying to get the link to scroll to is the first row under "Featured Research."


Would I use this as the URL?

Or this?


This is the only section of source code on the page that I can find that says "hearing-review".  Is that the correct way to name the section? Come to think of it, that appears to lead to the "Featured Research" headline rather than the first row of content underneath it. Or am I misinterpreting the code?



Not applicable

Re: Can't link to anchors from emails

Hi Nicholas

You mentioned that in your experience not all email clients will respond to anchor links. Do you know if this is the case for Outlook? I have followed the steps but cannot seem to get the anchors to work.

When I view the html version of my email the links work fine, but not when I view the email in both Outlook and Gmail.

Any comment would be much appreciated!

Not applicable

Re: Can't link to anchors from emails

I've just seen another article talking about exactly this which provides some answers:

Level 9

Re: Can't link to anchors from emails

Hi Dominic - I actually misinterpreted the initial question.

The link itself to an external webpage anchor will be fine.

For whatever reason I thought the scenario was an anchor within the email.