Skip to content

Commit a6552eb

Browse files
committed
minor
1 parent 61910d1 commit a6552eb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: 2-ui/5-loading/03-onload-onerror/1-load-img-callback/solution.view/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636

3737
// for each image,
38-
// let's create another img with the same src and check that we have its width immediately
38+
// let's create another img with the same src and check that we have its width
3939
function testLoaded() {
4040
let widthSum = 0;
4141
for (let i = 0; i < sources.length; i++) {

Diff for: 2-ui/5-loading/03-onload-onerror/article.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ This rule also affects resources from other domains.
113113

114114
If we're using a script from another domain, and there's an error in it, we can't get error details.
115115

116-
For example, let's take a script with a single (bad) function call:
116+
For example, let's take a script `error.js` that consists of a single (bad) function call:
117117
```js
118118
// 📁 error.js
119119
noSuchFunction();
120120
```
121121

122-
Now load it from our domain:
122+
Now load it from the same site where it's located:
123123

124124
```html run height=0
125125
<script>
@@ -155,15 +155,15 @@ Script error.
155155
, 0:0
156156
```
157157

158-
Details may vary depending on the browser, but the idea is same: any information about the internals of a script is hidden. Exactly because it's from another domain.
158+
Details may vary depending on the browser, but the idea is same: any information about the internals of a script, including error stack traces, is hidden. Exactly because it's from another domain.
159159

160-
Why do we need the details?
160+
Why do we need error details?
161161

162-
There are many services (and we can build our own) that listen to `window.onerror`, save errors at the server and provide an interface to access and analyze them. That's great, as we can see real errors, triggered by our users. But we can't see any error information for scripts from other domains.
162+
There are many services (and we can build our own) that listen to global errors using `window.onerror`, save errors and provide an interface to access and analyze them. That's great, as we can see real errors, triggered by our users. But if a script comes from another origin, then there's no much information about errors in it, as we've just seen.
163163

164164
Similar cross-origin policy (CORS) is enforced for other types of resources as well.
165165

166-
**To allow cross-origin access, we need `crossorigin` attribute, plus the remote server must provide special headers.**
166+
**To allow cross-origin access, the `<script>` tag needs to have `crossorigin` attribute, plus the remote server must provide special headers.**
167167

168168
There are three levels of cross-origin access:
169169

0 commit comments

Comments
 (0)