You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/1-getting-started/1-intro/article.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,11 @@ Modern interpreters actually combine these approaches into one: the script is di
51
51
52
52
The modern JavaScript is a "safe" programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.
53
53
54
-
Other capabilities depend on the environment which runs JavaScript. In the browser JavaScript is able to do everything related to webpage manipulation, interaction with the user and the webserver.
54
+
Other capabilities depend on the environment which runs JavaScript. For instance, Node.JS has functionality that allows JavaScript to read/write arbitrary files, perform network requests etc etc.
55
55
56
-
In more details, JavaScript is able to:
56
+
In the browser JavaScript can do everything related to webpage manipulation, interaction with the user and the webserver.
57
+
58
+
In more details, in-browser JavaScript is able to:
57
59
58
60
<ul>
59
61
<li>Create new HTML tags, remove the existing ones, change styles, hide/show elements...</li>
@@ -68,9 +70,11 @@ In more details, JavaScript is able to:
68
70
JavaScript abilities in the browser are limited. That is for user safety, mainly not to let an evil webpage access private information or harm the user's data.
69
71
70
72
<ul>
71
-
<li>JavaScript may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS system functions.
73
+
<li>JavaScript on the webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS system functions.
72
74
73
75
Modern browsers allow it to work with files, but limit the access to a specially created directory called "a sandbox". There are ways to interact with camera/microphone and other devices, but they require an explicit user's permission.
76
+
77
+
So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to NSA.
74
78
</li>
75
79
<li>JavaScript may not freely access other pages opened in the same browser. The exception is when the pages come from the same site.
0 commit comments