I have a function that generates a table of contents. It works perfectly. However, this also works when the page is in edit mode and causes a lot of damage.
For that, I found the solution in the second part of the code below. The code seems to work well as evidenced by the outputs in the console log, corresponding to the current site ("true") or not ("false") in edit mode. However, when the site is NOT in edit mode, I think it's calling the GenerateTOC function, but this is not the case.
_spBodyOnLoadFunctionNames.push (GenerateTOC & nbsp;)
but I guess it does not apply anymore …