???? key points ??? Web optimization

Principles:

  • ???????????????????? (User perception)
  • ????????????????????? network (Round-trip)
  • Optimization should not ruin UX.

Techniques:

General Technique

  • ??? JS script load ??????????????? ??? onload event
  • ??????? download ????????????
  • ???????????????????????? ?????????? compression rate
  • ????? favicon.ico ??? site ??????? ??????? browser ???????????? request ?????? ?????
  • Pre-cache page ????? ...

Image file and Tag

  • Move to near top of <body> tag
  • Use Different Domain Name
  • ???? width ??? height ????
  • ????????? ??? CSS position ??????? Javascript ????????????? load image ????????????????????????????
  • ???????????????????? <script>
  • ??? Image sprites ?????? load ?????????? ????????

JS Scripts

  • Reduce the number of script files as many as possible.  Ideally, one file a page.
  • ????????? document.write() ???????????????????????????????????? load JS script ????????
  • Put scripts in the end of HTML file.  Because when a browser loads script, it usually stops loading everything else.
  • ??? <script> ????????? <div> ???????? manipulate DOM ???????????????????????????? (?????? JS script ??????? 3rd party)
  • ??? <script defer="true"> ????????

CSS

  • ??? CSS ????? ?????? spacer.gif
  • render CSS ??? embeded ?????? PLT1 ???? PLT2 ??????????? <link> tag

HTML

  • ????????????? JS ??? content ???? ??????????????????????
  • ?????? <table> ???????? <col width="xx"> ????
  • ????? <meta charset> ???? (??????? <title>)
  • ??? CSS ??????? ?? control load time ???????????

Cookies

  • ???????? set cookies ???????????? static file ????????????????????? ?????????? dynamic content ????????? folder ??????????