Recent searches


No recent searches

Supported HTML for help center articles



image avatar

Elizabeth Williams

Zendesk Documentation Team

Edited Feb 19, 2025


0

2

2 comments

Hi there,

 

I've got an article (outside of zendesk) that handles anchor tags like this where the scrollIntoView function is defined elsewhere.  Is this kind of content allowed with an article?  I'm finding that when I copy the html contents to a zendesk article, the onclick section is removed.

 

<a onclick=" function onLinkClick(){

                    document.getElementById('part-one-privacy-practices').scrollIntoView();

                    }; onLinkClick()"

                >

                    PART ONE: PRIVACY PRACTICES

</a>
 

0


image avatar

Jakub

Zendesk Customer Care

Hello Jennifer!
 
The onclick attribute you're using contains JavaScript code, which is likely being stripped out by content sanitizer for security reasons. Zendesk, in particular, does not allow the use of inline JavaScript within its Help Center articles.
 
This means that any JavaScript code directly included in HTML attributes (like onclick, onmouseover, etc.) will be removed.
 
I would recommend trying these options:
 
  1. Enable unsafe content in your Help Center:

    In Guide, click the Settings icon () in the sidebar.
    Under Security, select the Display Unsafe Content option.
    Click Update.
     
  2. Try a workaround with an article without inline JS:

    Use in your article: 

    <a href="#part-one-privacy-practices" id="link-to-part-one">
        PART ONE: PRIVACY PRACTICES
    </a>

    And in script.js in the theme:

    document.addEventListener('DOMContentLoaded', function() {
        var linkToPartOne = document.getElementById('link-to-part-one');
        if (linkToPartOne) {
            linkToPartOne.addEventListener('click', function(event) {
                event.preventDefault();
                var target = document.getElementById('part-one-privacy-practices');
                if (target) {
                    target.scrollIntoView();
                }
            });
        }
    });

0


Please sign in to leave a comment.