简体   繁体   中英

What are the likely main reasons my website is very slow on IE?

I need to know what can be the main reasons (apart from the basics like grouping CSS selectors, reducing image size, using image sprite etc.) which makes a website slow on Internet Explorer, because my website works fine on the others like FF, chrome etc.

  1. Is it the huge use of Javascript framework (ie. jQuery, extjs, prototype)?
  2. Is it because of the use of plugins based on JS framework?
  3. Should I use core javascript and remove the use of any js framework?
  4. Should I try to avoid using jQuery(document).ready()? in case of jQuery framework?

Above some of the questions which I know and please answer the questions which I couldn't ask because of lesser knowledge about these.

I need to make my website perform well on IE (6,7,8) also please suggest.

Thanks

It has nothing to do with jQuery. The plugins however are hit or miss, and may not be well tested in IE. I'd use at your own risk.

DOM manipulation is very slow in IE. using appendChild (or insertRow) to add multiple nodes (say, 100+ for a long list) is much slower than building a string and doing one innerHTML.

You also want to be careful how you access nodes. Devs tend to rely upon jQuery too much and search for nodes via their class names, like:

$(".evenRows").hover(doSomething);

IE doesn't have a native way of getting a node by class name, so JQ is looping through the entire document and every single element and checking its class name... which needs to be checked via RegExp because it may look like:

class="evenRows yellow foo bar"

Finally, in spite of its improvements, IE8 is still using an old rendering engine - the same as IE6. Don't go crazy with the animations, and don't expect miracles.

由于MSIE的默认限制为2个并发连接,因此应尽量减少构建页面所需的请求数(使用css-sprites,将js和css文件合并为一个文件)

While you need to speed things up in IE, you can still use Firebug to look for places, that consume resources.

  • Install Yslow and see what it tells you
  • Run the site under profiler (Yslow or Firebug have one) and look for a bottleneck

It is very difficult to answer general questions like this, but jQuery is unlikely to be the one slowing everything down, just remember to

  • Use IDs as selectors wherever possible — they are the fastest, ie $('#myid')
  • Avoid using .class selectors without tagname, ie $('div.myclass') can be ten times faster than $('.myclass') .

and so on

More tips for using jQuery to achieve better performance.

通常,较早版本的IE会比早期版本的IE运行JavaScript慢,因为自那时以来,JavaScript的编译速度已有所提高。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM