Home » Guides Beginner Article

How to Use JavaScript to Enhance your Website, in Comparison to Flash Technology

Not rated
Rate:

Jack Dawson
September 15, 2015


Jack Dawson

Jack Dawson is a web developer and UI/UX specialist at BigDropInc.com. He works at a design, branding and marketing firm, having founded the same firm 9 years ago. He likes to share knowledge and points of view with other developers and consumers on platforms.



Jack Dawson has written 1 articles for JavaScriptSearch.
View all articles by Jack Dawson...

JavaScript is an increasingly popular way for websites to add extra functionality. However, overusing JavaScript can make a site slow to render, bloated and impossible to interpret for indexing purposes. While many strides have been made to enable Google’s crawling bots to interpret JavaScript, they are still not fully proficient, and hence this can make a site to be skipped over or ranked poorly for their target searches.

As a rule, JavaScript should be used when and only when the result will enhance user experience. Usually it is applied as a final layer once a website’s functional elements have been designed and implemented – kind of like icing on a cake. This approach is called progressive enhancement and it allows a site to function in the same way, the technology being used in the browser notwithstanding.

With progressive enhancement, when a user has a JavaScript-enabled browser, they will be able to view the extra functions made using JavaScript. However, lack thereof will still render the other functional elements of the site. This ensures that users with the most basic browsers are still able to access your site, which is extremely important given that your audience will not always have access to the same level of technology as you.

Take the example of a web design and development website. Once the content about various services has been added and displayed, JavaScript can be used to separate different elements within each service area into tabs. Users with enabled browsers will thus see the tabs, but those without will still be able to see the content, only in a more traditional way.

Choosing between Flash Animation and JavaScript

The days before JavaScript were quite simple – if a web designer wanted to add a little bit of flair to a site, they simply used Flash animation. In those times, JavaScript was clunky and tedious, especially when implementing animation or transitions, and there were a lot of cross-browser discrepancies.

On the other hand, Flash rendered smooth, rich presentations for websites, with plugins that rendered consistently regardless of the browser being used. However, since the development of jQuery and MooTools as well as more developed browsers with richer functionality, the decision is not as easy to make.

Below are a few pointers for web designers wondering whether to use Flash or JavaScript to enhance their websites.

1.      The statistics

The exact figures for the number of browsers which are JavaScript enabled and those which are based on Flash are not easy to determine.

However, sources indicate that 90 – 95% of all web users can access both through their browsers. For the remaining 5 – 10%, the lack of access is principally attributable to deliberate lockdowns within internal networks of large corporations and/or installation of third party add-ons. With this in mind, there isn’t an advantage that one enjoys over the other when considering market penetration alone.

2.      Accessibility

Accessibility of content is another factor to be considered. Flash has proven itself rather fickle where this is concern, but many such instances can be attributed to slothful design and production techniques rather than shortcomings inherent in Flash itself. JavaScript conversely is able to manipulate standard HTML, but poorly-written CSS and code will still interfere with content accessibility.

Nonetheless, Flash still presents an underlying problem, particularly regarding its proprietary behavior. For instance, certain basics of the user interface such as normal page loading cues and back buttons may be omitted where users expect them. JavaScript may also be subject to the same issues (especially used together with AJAX), but in very few circumstances. Most often, the browser accessibility features and default behavior will prevail.

3.      Graceful degradation

This applies to the 5 – 10% users who don’t have access to JavaScript or Flash on their browsers for any reason. Both tools can supply alternate content for viewers, but development using Flash has a clear downside: the alternate format is completely unfamiliar to Flash development.

For example, where data to the Flash file is being supplied from an XML source or database and the designer/developer is trying to implement a genuine fallback, they will have to write a solution to the backend process to enable extraction of information to be presented in HTML format.

Here, JavaScript is openly superior, given that it takes up standard HTML code which is then manipulated in the user’s browser to present information to a user. This implies that the method applied to the creation of the standard HTML code to present content in a certain way can simply double up as the fallback presentation. For users, this means that the alternate content will more likely remain synced with the JavaScript-enabled format. For the developer, this means less effort is needed in the development process.

4.      SEO

Again, JavaScript was a clear advantage over Flash in this area. Provided the code used to supply JavaScript is in standard HTML format, search engines can still see and analyse the content hence index the pages. While Flash offers SEO capability, this will require reliance on search engine makers to develop their bots to the level where they are able to delve into the inner Flash mechanisms and ascertain the content. This places it at a clear disadvantage over JavaScript.

5.      Applications

JavaScript and Flash are most often used to render video players and complex animations, where HTML5 has a clear advantage. However, JavaScript has MooTools which have the same capabilities as Flash in opacity, slides, and slideshow transitions, among others. These functions are better created using JavaScript since it provides lightweight code. Also, in many cases, the fallback for non-supported browsers is more easily implemented.

Conclusion

JavaScript and HTML5 are increasingly becoming the default choice for sites and applications that require additional functionality while Flash continues to decline. For complex animations and video, HTML5 is the clear leader, but JavaScript emerges superior in many other aspects due to its lightweight code implementation.

This makes it the best option to add the extras to a website or application, as well as implementation in SEO-critical zones.

Author Bio

Jack Dawson is a web developer and UI/UX specialist at BigDropInc.com. He works at a design, branding and marketing firm, having founded the same firm 9 years ago. He likes to share knowledge and points of view with other developers and consumers on platforms.


Add commentAdd comment (Comments: 0)  

Advertisement

Partners

Related Resources

Other Resources

arrow