Documentation

landing.repo.checkContent

landing.repo.checkContent(
   content,
   splitter 
)

The method checks the content for hazardous substrings. Such substrings include onclick="", <iframe> and several others. With the usual case, the triggering variants are minimal. The method is used exclusively to control the content when blocks are registered.

Parameters

Parameter Description Available from version
content Content for testing.
splitter Optional parameter to split bad substrings. By default value is #SANITIZE#.

Example

BX24.callMethod(
   'landing.repo.checkContent',
   {
      content: '<div style="color: red" onclick="alert(123)"><iframe src="//evil.com"></iframe></div>',
      splitter: '#AAA#'
   },
   function(result)
   {
      if(result.error())
         console.error(result.error());
      else
         console.info(result.data());
   }
);

The response returns:

content:"
" is_bad:true

The mark is_bad = true, indicates that the contents have bad areas and the text itself is formatted by separators in bad locations. Developer should modify such places before registration.



© «Bitrix24», 2001-2025