Configure HTML sanitizer

tomeczek1
Tera Contributor

Hi all,

While knowledge creation some of HTML code is removed by service now. I realize there might be some limitation. Using HTML sanitize configuration I would like to save from removing this block of code :   <a href="tel:phone number"></a>. The code turns all   phone numbers to clickable.

I was trying to insert in System Definition->Script Inculde->HTMLSanitizerConfig   this:

HTML_WHITELIST:{

a:{

        attribute:["href"],

        attributeValuePattern:{href:"tel:"}

},

It does not work:(

Could you please advice?

1 ACCEPTED SOLUTION

I've run into a similar issue, but the above code is actually not working at all. You actually need to extend the supported protocols used in url attributes by:

HTML_WHITELIST : {
		globalAttributes: {
			attribute:[],
			attributeValuePattern:{}
		},	
		urlAttributes: { "protocols" : ["tel"] }
	}

View solution in original post

3 REPLIES 3

manishmundra
ServiceNow Employee
ServiceNow Employee

Please have a look on below documents - >



Configure HTML sanitizer



Enable HTML Sanitizer logging


sethhumphrey
Mega Guru

HTML sanitizer documentation

Activate HTML sanitizer

 

Try this in System Definition->Script Includes->HTMLSanitizerConfig:

HTML_WHITELIST : {
       globalAttributes: {
              attribute:[],
              attributeValuePattern:{}
       },

       a:{
              attribute:[],
              attributeValuePattern:{href:"tel:*"}

       },

},

I've run into a similar issue, but the above code is actually not working at all. You actually need to extend the supported protocols used in url attributes by:

HTML_WHITELIST : {
		globalAttributes: {
			attribute:[],
			attributeValuePattern:{}
		},	
		urlAttributes: { "protocols" : ["tel"] }
	}