Programs made in this language are known as scripts. These programs can be written directly in our HTML because we can embed it in our initial HTML layout, either as a call to an external document, or by calling another section of the same document, and this is executed automatically as the web page loads.
The scripts are provided and run as plain text. This means that the browser is able to interpret the JS code immediately, so it does not need special preparation or compilation to run.
Different engines have different «code names», for example:
V8 – in Chrome and Opera.
SpiderMonkey – in Firefox.
… There are other code names like «Trident», «Chakra» for different versions of IE, «ChakraCore» for Microsoft Edge, «Nitro» and «SquirrelFish» for Safari, and so on.
The above terms are good to remember, because they are used in developer articles on the Internet. And maybe one day you will need them too. For example, if «an X feature is supported by V8», then it probably works in Chrome and Opera.
- Add new HTML to the page, change existing content, modify styles, etc.
- Reacts to user actions, executes mouse clicks, pointer movements, keystrokes, among others.
- It sends requests over the network to remote servers, downloading and uploading files (so-called AJAX and COMET technologies).
- It gets and sets cookies, it can ask questions of the web page visitor, and it can even display messages.
Save the data on the client side («local storage»).
Here below I list some of the restrictions that JS has in your browser.
- Modern browsers allow you to work with files, but access is limited and only provided if the user performs certain actions, such as «dropping» a file into a browser window, or selecting it using an <input> tag.
The limitation is again for the safety of the user. A page on http://anysite.com that a user has opened must not be able to access