How To Add Hyperlink To Azure B2C Custom Policy Terms Of Service Claim

Anonymous
2023-02-16T20:50:35.4266667+00:00

How can I add a hyperlink to text in the terms of service agreement claim here?User's image

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marilee Turscak-MSFT 37,206 Reputation points Microsoft Employee Moderator
    2023-02-22T00:25:46.8466667+00:00

    Hi Dale Yarborough,

    To add a hyperlink to the Terms of Service page, you need to add this JavaScript to your HTML page:

    function addTermsOfUseLink() {
        // find the terms of use label element
        var termsOfUseLabel = document.querySelector('#api label[for="termsOfUse"]');
        if (!termsOfUseLabel) {
            return;
        }
    
        // get the label text
        var termsLabelText = termsOfUseLabel.innerHTML;
    
        // create a new <a> element with the same inner text
        var termsOfUseUrl = 'https://learn.microsoft.com/legal/termsofuse';
        var termsOfUseLink = document.createElement('a');
        termsOfUseLink.setAttribute('href', termsOfUseUrl);
        termsOfUseLink.setAttribute('target', '_blank');
        termsOfUseLink.appendChild(document.createTextNode(termsLabelText));
    
        // replace the label text with the new element
        termsOfUseLabel.replaceChild(termsOfUseLink, termsOfUseLabel.firstChild);
    }
    

    Alternatively, you can add a link at the bottom of self-asserted pages, without using JavaScript by using the following localization and replacing the termsOfUseUrl with your organization's TOU URL:

    <LocalizedResources Id="api.localaccountsignup.en">
      <LocalizedStrings>
        <!-- The following elements will display a link at the bottom of the page. -->
        <LocalizedString ElementType="UxElement" StringId="disclaimer_link_1_text">Terms of use</LocalizedString>
        <LocalizedString ElementType="UxElement" StringId="disclaimer_link_1_url">termsOfUseUrl</LocalizedString>
        </LocalizedStrings>
    </LocalizedResources>
    

    See related for more examples:

    How to add text or link to AD B2C Terms and condition

    How to customize AADB2C SUSI to include acceptance of terms and conditions?
    Custom elements and ordering of UI with AAD B2C Custom Policies

    Let me know if this helps and if you have further questions.

    -

    If the information helped you, please Accept the answer. This will help us as well as others in the community who might be facing similar issues.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.