Skip to content

Commit ed382c2

Browse files
authored
Update translation of 5-network/05-fetch-crossorigin (javascript-tutorial#724)
Update translation of 5-network/05-fetch-crossorigin (javascript-tutorial#724)
1 parent e545fa3 commit ed382c2

3 files changed

Lines changed: 146 additions & 147 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
We need `Origin`, because sometimes `Referer` is absent. For instance, when we `fetch` HTTP-page from HTTPS (access less secure from more secure), then there's no `Referer`.
1+
我们需要 `Origin`,是因为有时会没有 `Referer`。例如,当我们从 HTTPS(从高安全性访问低安全性)`fetch` HTTP 页面时,便没有 `Referer`
22

3-
The [Content Security Policy](http://en.wikipedia.org/wiki/Content_Security_Policy) may forbid sending a `Referer`.
3+
[内容安全策略](http://en.wikipedia.org/wiki/Content_Security_Policy) 可能会禁止发送 `Referer`
44

5-
As we'll see, `fetch` also has options that prevent sending the `Referer` and even allow to change it (within the same site).
5+
正如我们将看到的,`fetch` 也具有阻止发送 `Referer` 的选项,甚至允许修改它(在同一网站内)。
66

7-
By specification, `Referer` is an optional HTTP-header.
7+
根据规范,`Referer` 是一个可选的 HTTP-header
88

9-
Exactly because `Referer` is unreliable, `Origin` was invented. The browser guarantees correct `Origin` for cross-origin requests.
9+
正是因为 `Referer` 不可靠,才发明了 `Origin`。浏览器保证跨源请求的正确 `Origin`

5-network/05-fetch-crossorigin/1-do-we-need-origin/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ importance: 5
22

33
---
44

5-
# Why do we need Origin?
5+
# 我们为什么需要源(Origin)?
66

7-
As you probably know, there's HTTP-header `Referer`, that usually contains an url of the page which initiated a network request.
7+
你可能知道有一个 HTTP-header `Referer`,它通常包含发起网络请求的页面的 url
88

9-
For instance, when fetching `http://google.com` from `http://javascript.info/some/url`, the headers look like this:
9+
例如,当从 `http://javascript.info/some/url` fetch `http://google.com` 时,header 看起来如下:
1010

1111
```
1212
Accept: */*
@@ -20,9 +20,9 @@ Referer: http://javascript.info/some/url
2020
*/!*
2121
```
2222

23-
As you can see, both `Referer` and `Origin` are present.
23+
正如你所看到的,存在 `Referer` `Origin`
2424

25-
The questions:
25+
问题是:
2626

27-
1. Why `Origin` is needed, if `Referer` has even more information?
28-
2. If it possible that there's no `Referer` or `Origin`, or it's incorrect?
27+
1. 为什么需要 `Origin`,如果 `Referer` 甚至具有更多信息?
28+
2. 如果这里没有 `Referer` `Origin` 可行吗,还是说会出问题?

0 commit comments

Comments
 (0)