0

I have something going on that's almost backwards (IE8 being the hero!?)

My organization recently upgraded to SharePoint 2013 from 2007 and brought a whole slew of changes with it. One major change - Content Editor Web Parts now don't do so well with custom HTML, CSS, and JS.

Along with that we upgrade to IE9 (bit dated I know, don't rub it in). I have a script that has been running absolutely fine until the upgrades. Now with IE9 and SharePoint 2013, I load a document library with a Script Editor webpart and the code below and the page goes white.

I narrowed it down to this, but I don't know why. If I comment out the JQuery, everything loads again. The others are not a problem, just this for some reason.

 <script type="text/javascript">
  $(document).ready(function(){ 
  $('.video').hide().before('<a href="#" id="toggle-video" class="button">Open/Close Video  Tutorial</a>');
 $('a#toggle-video').click(function() {
    $('.video').slideToggle(1000);
    return false;
});
});
</script>

On debug I get the following message in IE9+ but not IE8

"SCRIPT5022: DOM Exception: HIERARCHY_REQUEST_ERR (3) jquery.min.js, line 104 character 225"

Wonder if there's a way I can force this to render as if it were IE8..

Anyway thanks for your time!

Here's the full snippet.

<!DOCTYPE HTML>
<html>

<head>
 <!-- JS -->
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"     type="text/javascript"></script>
 <script type="text/javascript">
 $(document).ready(function(){  
  $('.practice').hide().before('<a href="#" id="toggle-practice"     class="button2">Open/Close Practice Council View</a>');
 $('a#toggle-practice').click(function() {
     $('.practice').slideToggle(1000);
    return false;
 });
  });
 </script>


<script type="text/javascript">
$(document).ready(function(){   
$('.policy').hide().before('<a href="#" id="toggle-policy" class="button">Open/Close     Policy Central Live View</a>');
$('a#toggle-policy').click(function() {
    $('.policy').slideToggle(1000);
     return false;
 });
 });
 </script>

 <script type="text/javascript">
  $(document).ready(function(){ 
  $('.video').hide().before('<a href="#" id="toggle-video" class="button">Open/Close Video  Tutorial</a>');
 $('a#toggle-video').click(function() {
    $('.video').slideToggle(1000);
    return false;
});
});
</script>


<script type="text/javascript">
$(document).ready(function(){   
$('.resources').hide().before('<a href="#" id="toggle-resources" class="button2">Open/Close Resources</a>');
$('a#toggle-resources').click(function() {
    $('.resources').slideToggle(1000);
    return false;
});
});
</script>


<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

 <div class="policy">
 <iframe src="http://XXX/XXX" width="100%" height="600">
</iframe>
 </div>

<br><br>

<div class="practice">
<iframe src="http://XXX/XXX" width="100%" height="600">
</iframe>
 </div>

<br><br>

<div class="video">
<center>No Video Available</center>
</div>

<br><br>

<div class="resources">
<center><p><a href="XX"> XX</a><br><br></p>    </center>
</div>



</body>
</html>
BR89
  • 716
  • 1
  • 6
  • 23
  • Here's a whole bunch of reasons why you might get `HIERARCHY_REQUEST_ERR` and they all look like they are probably from the `.before()` statement: http://stackoverflow.com/questions/1256394/what-exactly-can-cause-an-hierarchy-request-err-dom-exception-3-error – jfriend00 Mar 22 '14 at 16:01
  • Looks like there's some browser differences from that response. I know you can force HTML to render as IE8, does this work for JQuery too? something like – BR89 Mar 22 '14 at 16:07
  • 2
    You really don't want your page to try to pretend to be IE8. You should "fix" the actual problem. If this were me, I'd use the non-minimized jQuery and I'd step into the `.before()` operation in the debugger and carefully examine the arguments to the `.insertBefore()` that happens inside of jQuery's `.before()` and see exactly what is happening that causes this error. They, you'd have your next clue for how to fix it. Somehow the arguments that are getting set for `.insertBefore()` are goofed up. – jfriend00 Mar 22 '14 at 16:10
  • I can't reproduce the issue in this jsFiddle: http://jsfiddle.net/jfriend00/2Tdjg/. Are you really still using jQuery 1.4.2? That's ancient. – jfriend00 Mar 22 '14 at 17:03
  • It's a pretty old script. I have a feeling something is not agreeing with the SharePoint server. Unfortunately I am limited to just editing within Web Parts and can't actually access SharePoint Designer otherwise this would be much easier. I'll getting a newer version of JQuery. – BR89 Mar 22 '14 at 17:23

0 Answers0