Thursday 12 July 2012

JavaScript versions and browser support


JavaScript versions and browser support

As already stated, the core of JavaScript comes from ECMAScript, which is currentlyin version 5 as of 2009. The most current version of JavaScript, based upon ECMAScript 5, is JavaScript 1. 8. 5, which came out in July of 2010. When programmingin JavaScript, however, these facts are less critical than what’s possible in whatbrowsers. Most modern browsers support ECMAScript 3 and parts of ECMAScript 5(no version 4 of ECMAScript was ever officially released).

“Modern browsers” is a phrase you’ll see a lot in this web-ste and elsewhere. Roughlyspeaking, modern browsers support core JavaScript, DOM manipulation, theXmlHttpRequest object (used to make Ajax requests), and basic CSS. In sum, modernbrowsers are capable of making the most of today’s dynamic Web technologies. This broad definition includes most versions of Firefox, Chrome, Opera, and Safari,and versions of Internet Explorer after IE6 (IE6 has been the Web developer’s archnemesis for years). Note that the loose definition of “modern browsers” isn’t based solely uponJavaScript, but also upon other advances, such as the ability to perform DOMmanipulation. JavaScript is frequently used to manipulate the DOM, but the DOMis defined and managed by the W3C (World Wide Web Consortium, w3 org).

Different browsers also support the DOM in different ways, which means that whencreating dynamic Web sites, one has to factor in not only variations in JavaScriptsupport, but also DOM support and CSS support (and HTML5 support, shouldyou choose). As of August 1, 2011, Google decided to start supporting a more modest listof modern browsers (supporting for Web applications; the Google search engineis usable in any browser, of course). Google’s criteria is simply the most currentrelease of Chrome, Firefox, IE, and Safari, plus the preceding release of each. Onthe one hand, this approach does exclude a decent percentage of Web users andsome browsers that would otherwise be deemed “modern. ” On the other hand, theapproach acknowledges that changes come with new versions of browsers, and thatthere’s a good reason to drop older versions, just as users ought to be constantlyupgrading their browsers, too.

Yahoo!, in conjunction with the Yahoo! User Interface (YUI) JavaScript framework(http://yuilibrary. com), developed its own Graded Browser Support system(yuilibrary com). Rather than identify whatbrowsers are officially supported, the list identifies the browsers one ought to test asite on. Yahoo!’s list, as of July 2011, includes Internet Explorer versions 6 through 9,Firefox versions 3 through 5, the latest stable version of Chrome, and Safari 5. But what do any of these lists mean for you as a JavaScript programmer? Knowingwhat different versions of different browsers can do is good for your own edification,but will not be the basis of your JavaScript programming. A decade ago,when there weren’t that many browsers, JavaScript code was written specificallychecking the browser type and version (as shown in earlier code): Is this InternetExplorer or Netscape Navigator? Is it version 4 or 5 or 5. 5? With literally thousandsof different browser types and versions available (when you factor in mobile devices),it’s impossible to target specific browsers and versions. Furthermore, for any numberof reasons, browsers will wrongfully identify themselves. And even if you canovercome those two hurdles, the code will be outdated with the next release of anew browser, a new browser version, or a new device with its own internal browser. Instead, in today’s modern JavaScript, code is written not for the browser butfor the browser’s capabilities. It’s a subtle but significant difference, and part of thebasis for proper modern JavaScript programming. In this web-ste, you’ll learn manytechniques for programming to what’s possible, rather than what browser is running. Still, after developing the code, you should still test the site on a range of browsers,like those in Yahoo!’s or Google’s lists. When working on a project for a client,you and the client will need to come up with your own list of supported browsers(this is something that ought to be stipulated in the contract, too). Keep in mind thata properly designed site should still fully function in a nonsupported browser; it justwon’t be able to take advantage of the dynamic functionality added by JavaScriptand other modern tools (like CSS3 and HTML5).
NOTE: search engines generally don’t recognize the effects of scripting. to make a site’s content findable by, and meaningful to, a search engine, it must exist in a nonscripted form.

No comments:

Post a Comment