Introduction to Javascript in the browser

What is JavaScript and what possibilities does it offer us when developing web pages on the client side. We start with some general knowledge of the language and a bit of its evolution.

In this article we want to address the particularities of using Javascript within the context of the browser, which is basically what we are going to learn throughout the entire manual. It will be a starting point for people who want to enter the world of client-side web programming.

How the Javascript Manual is structured

The Javascript course that we have prepared at .com is divided into two fundamental parts that we are going to summarize so that you understand what its particular objectives are.

  1. In this first manual we intend to explain, offering information on how to include scripts and deal with the most basic elements of any programming language, such as variables, operators, control structures, functions, etc.

  2. The second part of the manual will be dedicated to exploring more specific topics about , through the control of page elements and interaction with the user.

Note: In this first manual you will find that much more typical theoretical and practical information on programming languages ​​is offered. It will be essential to know how to take the first steps in programming, but it may be a bit more boring than the second part, where we will learn how to dynamically alter the web page, respond to user actions, etc.

We have wanted to explain things carefully, so that learning Javascript with this manual is within the reach of people even without programming knowledge. However, in .com there are several even more basic manuals to learn programming, such as the , or more specific for the web with the manual of or the .

However, perhaps more experienced people may prefer to go directly to , where we will explain more practical things and return to specific articles in this first part, to use them as a reference as they need to know the syntax of certain control structures, language operators , construction of functions, etc.

In this article we intend to explain what Javascript is in the context of the browser and what this language is for, at least in general terms, without going into the practical part yet. In this first series of articles you will be able to find basic information about the language, its main possibilities, most common uses and the work modes that we can use to develop our own scripts.

Note: Another resource that we want to recommend to learn Javascript, especially suitable for people with less experience, is the . Of course, we do not want to forget about the , as well as other more specific manuals that you will find in the category of .

what is javascript

Javascript is a programming language used to create dynamic behavior on web pages. With Javascript, at least in a first step, you will be able to create small programs in charge of carrying out actions within the scope of a web page, which generally includes special effects in the pages and implement interaction with the user. We call these small programs scripts, because they are often portions of code of limited size, which are responsible for performing very specific behaviors with which to improve the user experience when visiting a website.

The user’s browser is known as the “web client” and is in charge of interpreting the Javascript instructions and executing them to carry out these effects and interactivities, so that the greatest resource, and often the only one, that this language has is the own browser.

Javascript is the next step, after and , that a web programmer can take who decides to improve their pages and the power of their projects. It is a fairly simple programming language and designed to do things quickly, sometimes too lightly. Even people with no prior programming experience can easily learn this language and use it to its full power with just a little practice.

Among the typical actions that can be performed in Javascript we have two aspects.

  • On the one hand, the special effects on web pages, to create dynamic content and page elements that have movement, change color or any other dynamism.
  • On the other, javascript allows us to execute instructions in response to user actions, with which we can create interactive pages with programs such as calculators, agendas, or calculation tables.

Javascript is a language with many possibilities, although at the beginning we will start developing small scripts, it also allows us to create larger programs, object-oriented, with functions, complex data structures, etc. In fact, the most impressive websites you can imagine use a lot of Javascript to make the user experience so spectacular and personalized. Today, modern web applications offer, thanks to Javascript, a user experience almost more similar to what a desktop application would be. There are virtually no boundaries that we can’t reach with Javascript.

In this manual we are going to try to approach this language in depth and learn about all its secrets and working methods. At the end of the manual we will be able to control the flow in our Javascript programs and know how to place scripts to solve different needs that we may have. Everything that we will see next will serve as a base to delve into the development of rich pages on the client side later.

Some history of Javascript

A multitude of services have been created on the Internet to carry out many types of communications, such as mail, chats, transfers, information searches, etc. But none of these services has developed as much as the Web. If we are reading these lines we are not going to need any explanation of what the web is, but we can talk a little about how it has developed over the years.

The Web is a Hypertext system, a huge amount of interrelated texts through links. Each of the basic units where we can find information are web pages. At first, to design this system of pages with links, a language was thought that would allow each of this information to be presented together with some small styles, this language was HTML.

As the Web and its different uses grew, the pages and the actions that were wanted to be carried out through them became more complicated. Soon it became clear that HTML was not enough to perform all the actions that may be needed on a web page. In other words, HTML had fallen short since it only serves to present the text on a page and little else.

As websites became more complicated, one of the first needs was for the pages to respond to some user actions, to develop small functionalities beyond the links themselves. The first helper to meet the emerging needs was Java, which is a general purpose language. Java offered a way to embed programs in web pages, through the , with which you could create small programs that ran in the browser within the web pages themselves, but had similar capabilities to general-purpose programs. Applet programming was a breakthrough and Netscape, by then the most popular browser, had broken the first HTML barrier by making programming within web pages possible. There is no doubt that the appearance of Applets represented a great advance in the history of the web, but it has not been a definitive technology and many others have continued to implement the path that began with them.

Javascript arrives

Netscape, after making its browsers compatible with applets, began to develop a programming language called LiveScript that would allow you to create small programs on pages and was much easier to use than Java. So the first Javascript was called LiveScript, but that name did not last long, because before launching the first version of the product, an alliance was forged with Sun Microsystems, the creator of Java, to jointly develop this new language.

The alliance made Javascript designed as a little brother of Java, only useful within web pages and much easier to use, so that anyone without programming knowledge could delve into the language and use it without major difficulties. In addition, to program Javascript it is not necessary to have a development kit, nor to compile the scripts, nor to carry them out in files external to the HTML code, as was the case with applets.

Netscape 2.0 was the first browser that understood Javascript and its wake was followed by other web clients such as Internet Explorer starting with version 3.0. The Javascript execution engine inside Internet Explorer was named JScript by Microsoft and had slight differences from Javascript, which made it not 100% compatible with the engine running on Netscape.

Differences between different browsers

As we have said, Netscape’s Javascript and Microsoft Internet Explorer’s had slight starting differences. Even as the language itself evolved in the different versions of browsers and at the same time that web pages became more dynamic and demanding, the differences became accentuated.

This situation took years to correct, and during this time the differences in the way Javascript worked between browsers marked the history of the language and the way in which developers relate to it. For a long time, developers were forced to create code that worked correctly on different platforms and different versions of them. To this day, there are still some differences, although since the appearance of HTMl 5 the manufacturers reached an agreement to be faithful to the open standards and the compatibility problems were corrected.

However, not all browsers updated equally, and older versions of Internet Explorer still required extra effort to create Javascript compatible with all web clients. To solve all these problems, many products have emerged, such as , which help to carry out advanced functionalities without having to worry about making different versions of the scripts for each of the possible browsers on the market. In this sense it was the clear dominator of the market.

We’ve now reached a point where, fortunately, Javascript works pretty much…

See also  Mail Merge
Loading Facebook Comments ...
Loading Disqus Comments ...