6

I have this weird problem on one of our customer's SharePoint (2010): sometimes, on different pages, the page came out broken, with a bunch of HTML and scripts inside the normal page. I started checking the two HTML of the same page (the broken one and the good one) and only a little detail is different: this Javascript line is injected randomly inside the header or the body of some web part, totally brooking HTML, scripts and most of the interactions:

"); f.innerHTML = unescape(child.innerHTML) + ' '; count ++; } } }

I only found this line inside an XSL file that seems something related to preview (vwstyles.xsl), but really can't find why this problem should occur, and can't find any hint on this.

Just for reference, there are two DB servers, two application servers and two fronted servers. The problem seems to only and always occur on fronted servers. To let it disappear, a simple hit on the application server reset the situation and the fronted servers start working again, for a different time frame.

This looks completely weird to me.

This is the complete XSL/Javascript piece that seems to blow up:

<script>
  function showpreview<xsl:value-of select="$ViewCounter" />(o) { 
  count = 1;
  for(i = 0; i &lt; o.childNodes.length; i++)
  {
  var child = o.childNodes[i];
  if (child.style.display == &quot;none&quot; &amp;&amp; child.tagName == &quot;DIV&quot;)
  {
      f = document.getElementById(&quot;n&quot; + count + &quot;<xsl:value-of select="$WPQ" />&quot;);
      f.innerHTML =  unescape(child.innerHTML) + &apos;&#160;&apos;;
      count ++;
    }
  }
 }
</script>
1
  • 1
    It is not necessarily unusual for SharePoint to add or remove components in different situations. Delegate controls are used extensively to intentionally enable and disable scripts and features on sites. I have seen similar behavior when custom code will overwrite a part of the page and not account for different content in different scenarios. Perhaps it would help if you shared your feature config and the master page you are working from and make sure you note customizations and their intent
    – ghangas
    Oct 12, 2016 at 17:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.