JavaScript is a programming language that works on the client side and with which websites can be made more functional.

Integration into HTML code[edit]

JavaScript code can be embedded in HTML pages, so that they gain functionality. There are several options. It can be between the <SCRIPT> and </SCRIPT> tags (“inline variant”), it can be contained in an external file, it can be a parameter of HTML tags, and it can be embedded in the form of HTML links. When inserting it into the HTML code, make sure that the script does not have errors. Thus, bugs can be avoided which could adversely affect search engine optimization.


A scripting language such as JavaScript should implement DOM. DOM stands for “Document Object Model” and is a W3C recommendation. It is a general model for objects in a document.

Possible applications[edit]

JavaScript has many different applications. Site visits can be counted, monthly calendars shown, or form entries checked. Another commonly used example is the calculator. The virtual cart in webshops is a very sensible application. Bad examples are popup windows that usually flood users with advertising. It is also possible to hide the source code of a page from its visitors with JavaScript or to prevent the copying of images or texts. Since in this case the right mouse button is blocked, the user will also lose other functions and is unintentionally very limited.

CommonJS can serve as an extension of JavaScript. This makes programming interfaces possible, which are suitable for the implementation in applications such as databases, web services, and desktop applications.

Consequences of deactivation[edit]

Browsers offer users the option to disable JavaScript through NoScript add-ons. The visitors of a website can no longer use JavaScript applications, but will be protected against distracting advertising, for example. If too many elements on a website use JavaScript, then users will not enjoy visiting your website. Accessibility will be limited. A website should still be navigable even when JavaScript is disabled.

Security through the sandbox principle[edit]

The sandbox principle has been developed in order to protect users from the abuse of JavaScript applications. The sandbox is a kind of cage that restricts the language in its reach. An application cannot access local files, for example. Thus, unauthorized persons cannot read files or write into them.

Relevance to search engine optimization[edit]

A search engine generally disregards JavaScript code. The interaction enabled for users by JavaScript applications cannot be used by a crawler. It visits a website just as a user who has disabled JavaScript would and cannot reach webpages which are only accessible via JavaScript. Text that is displayed with JavaScript, is likewise not perceived by the search engine in most cases. Redirects are best implemented on the server side.

File size and performance[edit]

If a website has extensive interaction elements that have been implemented using JavaScript and placed at the end of the source code, it will increase the file size of each individual subpage. This in turn increases the crawling effort for the search engines. The loading time for users with slow Internet connections (such as smartphones) is increased for each subpage.

In this case, the code should be outsourced into an external JavaScript file and integrated at the end of the source code. The external file should also be cached in the user’s browser in order to be loaded with the first page view. This results in improved performance with the second page view and the search engines will also have an easier task, because the source code of the subpages is “leaner.” The crawler resources are thus used on more website content and indirectly promote a better ranking.

Loading time and conversion optimization[edit]

Some webmasters tend to outsource the JavaScripts of various subpages in individual external files. This can cause a lot of external JavaScript files being requested while browsing. This may cause an increase in rendering time because browsers have a set limit of maximum parallel downloads from these external files (this includes images and CSS files). With too many files and a slow Internet connection, it may happen that the page takes a long time to load, which equates to a poor “user experience” and thus may have a negative effect on the conversion rate.

Ideally, all JavaScript files should be merged into a single file that is then loaded by the user only once (caching) and thus prevents a double performance.

Rendering time and conversion optimization[edit]

Another trick to improve website performance and conversion, is to place the external JavaScript file(s) at the very end of the source code. The reason being that browsers may partially stop rendering the webpage at the point where an external file was linked and load that first. If the external JavaScript file is located on an external server, which responds slowly, the user initially sees only a blank page.

Only once all the scripts and CSS files are loaded will the rendering be ended. If you place the reference to the external file at the end of the source code, the content of the HTML file will be displayed and texts will be visible before full loading. The advantage is that users only have to wait to obtain access to the interaction features of JavaScript applications if there is a slow external server.

Web Links[edit]