Errors loading wordpress website on Internet Explo

2019-08-23 12:14发布

问题:

My website - http://www.myhomecare.ie - is a Wordpress Installation using the Sterling theme which is compatible with IE 8 and 9. Everything was running fine and looking good when I tested it in an IE 8 browser but its suddenly started throwing errors and displaying the menu vertically instead of horizontally in IE.

I contacted the support supplied by the theme makers but they have reported that it looks fine in their IE browsers.

Thinking it might just be my computer I tried it out on other computers in the office only to find the problem appears on IE 8 on all the computers at work. We do work off a large network so its possible that the network admins have the IE settings configured in a different way but still I need to get rid of this error in case our clients are viewing the site like this.

When I load the site in IE 8 I do get an error message at the bottom of the screen which displays the following issues:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0)
Timestamp: Fri, 17 Aug 2012 09:23:02 UTC


Message: 'jQuery' is undefined
Line: 1
Char: 1
Code: 0
URI: http://myhomecare.ie/wp-content/themes/Sterling/framework/js/IE.js


Message: Expected identifier, string or number
Line: 398
Char: 5
Code: 0
URI: http://myhomecare.ie/wp-content/themes/Sterling/framework/js/custom-main.js?ver=2.0


Message: Expected identifier, string or number
Line: 195
Char: 4
Code: 0
URI: http://myhomecare.ie/

I'm no expert with jquery but I do have some html and css knowledge. I need some help understanding what that error message has an issue with. I've tried removing the custom code I had put into the theme and disabling recent plugins but its not made any difference. I'm confused at why the problem is not across all IE 8 browsers. If anyone has any advice about where to go next with troubleshooting this I'd really appreciate it.

回答1:

The first error is referencing a javascript file which is loaded in your <head> using conditional code specifiying versions of IE less than or equal to version 8.

<!--[if lte IE 8]>
<script type="text/javascript" src="http://myhomecare.ie/wp-content/themes/Sterling/framework/js/IE.js"></script>
<![endif]-->

The issue is that this code is being called in your header, whilst jQuery is being called in the footer. jQuery needs to be loaded first prior to dependant scripts, that's why the error is saying it's undefined.

Move the code block given above into the footer underneath the other script includes and take it from there.

Note: Even though IE8 has the same 'undefined' error, it displays fine on my version, it's IE7 which isn't.

EDIT*

OK, we're taking it from there. The next error, on line 398 of;

http://myhomecare.ie/wp-content/themes/Sterling/framework/js/custom-main.js?ver=2.0

is being thrown because in this code block there is a comma after the last isotope paramter;

jQuery('#iso-wrap').isotope({
    animationOptions: {
     duration: 750,
     easing: 'linear',
     queue: false,
     }
});

Remove the comma after the word false.

This will also clear the last error, which is linked to the second.

As per your IE versions, that is a question for the network admins you mention, nobody here can know how they are set up.

EDIT 2

OK, based on your latest comment it's exactly the same problem as before, there's a trailing comma at the end of the slider paramters;

In you footer you have;

jQuery(document).ready(function(){
jQuery('#slides').slides({
      preload: false,
      //preloadImage: 'http://files.truethemes.net/themes/sterling-wp/ajax-loader.gif',
      autoHeight: true,
      effect: 'fade',
      slideSpeed: 500,
      play: 4000,
      randomize: false,
      hoverPause: true,
  });

});

Get rid of the comma after the last true.