Following best practices

A key question we must ask ourselves is to what extent we will support the use of particular browsers when developing our websites. The answer to this will lie in monitoring analytical software, to determine which browsers are being used.

In most cases, it should show modern browsers being used, but there are still limited instances of old browsers in use; for example, IE6 is still being used, although its market share is now a tiny 0.25%, as at April 2016. This raises the question of what we should support, if monitoring analytics for our sites shows that only a tiny percentage (that is, lower than 1%, for example) of usage is for older browsers, then we may take the decision to not support them if the effort and resources required do not justify the return from such a small market share.

This said, there are some basic tips that can help us optimize our sites:

  • We should avoid using hacks where possible. Conditional comments are a better option, although we should regularly check and remove styles if they are no longer applicable (such as vendor prefixes, which no longer apply).
  • Try to use <!DOCType html> in your code. This will indicate to the browser that it should follow HTML5 rules; it will degrade automatically if the browser does not support HTML5.
  • We can use the W3C Validation Service to check our code for consistency. A better option though is to build this into part of the development process; we can easily do this with Node.js, so it can be done automatically.
  • In the age of modern sites, JavaScript has become an essential tool for development. It is all too easy to resort to using it, without really considering the options available. Try to avoid using JavaScript if possible. It was designed to complement existing code, and should not be relied on to provide core functionality. The state of CSS is such now that styling functionality that previously was only possible with JavaScript may now be feasible with CSS and provide smoother results to boot!
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset