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
cache:"default", // no-store, reload, no-cache, force-cache, or only-if-cached
21
+
cache:"default", // no-store, reload, no-cache, force-cache ya da only-if-cached
22
22
redirect:"follow", // manual, error
23
-
integrity:"", //a hash, like "sha256-abcdef1234567890"
23
+
integrity:"", //bir hash, "sha256-abcdef1234567890" gibi
24
24
keepalive:false, // true
25
-
signal:undefined, //AbortController to abort request
25
+
signal:undefined, //İsteği iptal etmek için AbortController
26
26
window:window// null
27
27
});
28
28
```
29
29
30
-
An impressive list, right?
30
+
Etkileyici bir liste, değil mi?
31
31
32
-
We fully covered`method`, `headers`and`body`in the chapter <info:fetch-basics>.
32
+
<info:fetch-basics> bölümünde`method`, `headers`ve`body`tamamıyla ele alındı .
33
33
34
-
The `signal`option is covered in <info:fetch-abort>.
34
+
`signal`ise <info:fetch-abort> bölümünde ele alındı.
35
35
36
-
Now let's explore the rest of options.
36
+
Şimdi diğer özelliklerini inceleyelim.
37
37
38
38
## referrer, referrerPolicy
39
39
40
-
These options govern how `fetch`sets HTTP `Referer`header.
40
+
Bu özellikler `fetch`işleminin HTTP `Referer`bilgisini nasıl ayarladığını düzenler.
41
41
42
-
That header contains the url of the page that made the request. In most scenarios, it plays a very minor informational role, but sometimes, for security purposes, it makes sense to remove or modify it.
43
-
.
42
+
Bu başlık, istek yapan sayfanın URL’sini içerir. Çoğu durumda çok küçük bir bilgilendirme rolü oynar ama bazen güvenlik amacıyla kaldırmak veya değiştirmek daha mantıklıdır.
44
43
45
-
**The `referrer`option allows to set any `Referer` within the current origin) or disable it.**
44
+
**`referrer` özelliği başlangıçtaki mevcut herhangi bir `Referer`'ın ayarlanmasına veya devre dışı bırakılmasına izin verir.**
46
45
47
-
To send no referer, set an empty string:
46
+
Referer göndermemek için boş bir string yazın:
48
47
```js
49
48
fetch('/page', {
50
49
*!*
51
-
referrer:""//no Referer header
50
+
referrer:""// Referer içeriği boş
52
51
*/!*
53
52
});
54
53
```
55
54
56
-
To set another url within the current origin:
55
+
Mevcut başlangıç noktasında başka bir URL ayarlamak için:
57
56
58
57
```js
59
58
fetch('/page', {
60
-
//assuming we're on https://javascript.info
61
-
//we can set any Referer header, but only within the current origin
-**`"no-referrer-when-downgrade"`** -- default value: `Referer` is sent always, unless we send a request from HTTPS to HTTP (to less secure protocol).
73
-
-**`"no-referrer"`** -- never send`Referer`.
74
-
-**`"origin"`** -- only send the origin in`Referer`, not the full page URL, e.g. `http://site.com` instead of `http://site.com/path`.
75
-
-**`"origin-when-cross-origin"`** -- send full referrer to the same origin, but only the origin part for cross-origin requests.
76
-
-**`"same-origin"`** -- send full referrer to the same origin, but no referer for for cross-origin requests.
77
-
-**`"strict-origin"`** -- send only origin, don't send referrer for HTTPS→HTTP requests.
78
-
-**`"strict-origin-when-cross-origin"`** -- for same-origin send full referrer, for cross-origin send only origin, unless it's HTTPS→HTTP request, then send nothing.
79
-
-**`"unsafe-url"`** -- always send full url in `Referer`.
71
+
-**`"no-referrer-when-downgrade"`** -- Varsayılan değer: HTTPS'ten HTTP'ye bir istek göndermediğimiz sürece `Referer` her zaman gönderilir (güvenlik protokolü daha az).
72
+
-**`"no-referrer"`** -- Hiçbir zaman`Referer` göndermez.
73
+
-**`"origin"`** -- Belli bir URL'yi değil, sadece`Referer` kaynağını gönderir. Örneğin `http://site.com/path` yerine `http://site.com` gibi.
74
+
-**`"origin-when-cross-origin"`** -- Referer'ın tamamını aynı kaynağa gönderir ancak kaynaklar arasındaki istekler için yalnızca kaynak kısmını gönderir.
75
+
-**`"same-origin"`** -- Aynı kök URL'ye tam Referer gönderir, ancak farklı kök URL'ler arasındaki istekler için Referer göndermez.
76
+
-**`"strict-origin"`** -- Sadece kök URL'yi gönderir, HTTPS→HTTP istekleri için Referer göndermez.
77
+
-**`"strict-origin-when-cross-origin"`** -- Aynı kök URL'ye tam Referer gönderir, farklı kök URL'ler arasındaki istekler için sadece kök URL gönderir ancak HTTPS→HTTP isteği durumunda hiçbir şey göndermez.
78
+
-**`"unsafe-url"`** -- Her zaman `Referer`'da tam URL'yi gönderir.
80
79
81
-
Let's say we have an admin zone with URL structure that shouldn't be visible from outside.
80
+
Diyelim ki dışarıdan görünmemesi gereken URL yapılarına sahip bir yönetici bölgesi (admin zone) var.
82
81
83
-
If we send a cross-origin`fetch`, then by default it sends the `Referer`header with the full url of our page (except when we request from HTTPS to HTTP, then no`Referer`).
82
+
Eğer farklı bir kaynaktan (cross-origin) bir istek gönderirsek varsayılan olarak isteğimiz `Referer`başlığını sayfanın tam URL'siyle birlikte gönderir (ancak HTTPS'ten HTTP'ye istek gönderdiğimizde`Referer` gönderilmez).
The `mode`option serves as a safe-guard that prevents cross-origin requests:
104
+
`mode`seçeneği, kaynaklararası istekleri önlemek için bir güvenlik önlemi olarak hizmet eder.
106
105
107
-
-**`"cors"`** -- the default, cross-origin requests are allowed, as described in <info:fetch-crossorigin>,
108
-
-**`"same-origin"`** -- cross-origin requests are forbidden,
109
-
-**`"no-cors"`** -- only simple cross-origin requests are allowed.
106
+
-**`"cors"`** -- Varsayılan olarak <info:fetch-crossorigin>'de açıklandığı gibi kaynaklararası isteklere izin verilir,
107
+
-**`"same-origin"`** -- Kaynaklararası isteklere izin verilmez,
108
+
-**`"no-cors"`** -- Sadece basit olan kaynaklararası isteklere izin verilir.
110
109
111
-
That may be useful in contexts when the fetch url comes from 3rd-party, and we want a "power off switch" to limit cross-origin capabilities.
110
+
Bu, fetch işleminin URL'sinin üçüncü taraf bir kaynaktan geldiği durumlarda ve kaynaklararası yeteneklerini sınırlamak için bir "güç kapama anahtarı" istediğimiz durumlarda faydalı olabilir.
112
111
113
112
## credentials
114
113
115
-
The `credentials` option specifies whether `fetch`should send cookies and HTTP-Authorization headers with the request.
114
+
`credentials`, `fetch`işleminin isteğiyle birlikte çerezleri ve HTTP-Authorization başlıklarını gönderip göndermeyeceğini belirtir.
116
115
117
-
-**`"same-origin"`** -- the default, don't send for cross-origin requests,
-**`"omit"`** -- never send, even for same-origin requests.
116
+
-**`"same-origin"`** -- Varsayılan değerdir, kaynaklararası istekler için göndermez,
117
+
-**`"include"`** -- Her zaman gönderir ancak kaynaklararası sunucudan `Accept-Control-Allow-Credentials`gerektirir,
118
+
-**`"omit"`** -- Hiçbir zaman göndermez hatta aynı kök URL'ye sahip istekler için bile göndermez.
120
119
121
120
## cache
122
121
123
-
By default,`fetch`requests make use of standard HTTP-caching. That is, it honors `Expires`, `Cache-Control`headers, sends `If-Modified-Since`, and so on. Just like regular HTTP-requests do.
122
+
Varsayılan olarak`fetch`istekleri standart HTTP önbellekleme kurallarını kullanır. Yani `Expires`, `Cache-Control`başlıklarını dikkate alıp `If-Modified-Since` gibi başlıklar gönderir. Adeta normal HTTP istekleri gibi davranır.
124
123
125
-
The `cache` options allows to ignore HTTP-cache or fine-tune its usage:
124
+
`cache`, HTTP önbelleğini yok saymak veya kullanımını ayarlamak için kullanılır:
126
125
127
-
-**`"default"`** -- `fetch` uses standard HTTP-cache rules and headers;
128
-
-**`"no-store"`** -- totally ignore HTTP-cache, this mode becomes the default if we set a header `If-Modified-Since`, `If-None-Match`, `If-Unmodified-Since`, `If-Match`, or`If-Range`;
129
-
-**`"reload"`** -- don't take the result from HTTP-cache (if any), but populate cache with the response (if response headers allow);
130
-
-**`"no-cache"`** -- create a conditional request if there is a cached response, and a normal request otherwise. Populate HTTP-cache with the response;
131
-
-**`"force-cache"`** -- use a response from HTTP-cache, even if it's stale. If there's no response in HTTP-cache, make a regular HTTP-request, behave normally;
132
-
-**`"only-if-cached"`** -- use a response from HTTP-cache, even if it's stale. If there's no response in HTTP-cache, then error. Only works when `mode`is`"same-origin"`.
126
+
-**`"default"`** -- `fetch`, standart HTTP önbellekleme kurallarını ve başlıklarını kullanır;
127
+
-**`"no-store"`** -- HTTP önbelleğini tamamen yok sayar. Eğer `If-Modified-Since`, `If-None-Match`, `If-Unmodified-Since`, `If-Match` veya`If-Range` başlıklarından herhangi birini set edersek bu mod varsayılan olur;
128
+
-**`"reload"`** -- Sonucu HTTP önbellekten almadan (eğer varsa) cevap ile önbelleği doldurur (eğer cevap başlıkları buna izin veriyorsa);
129
+
-**`"no-cache"`** -- Önbellekte bir yanıt varsa koşullu bir istek oluşturur aksi takdirde normal bir istek yapar. HTTP önbelleği ile cevabı doldurur;
130
+
-**`"force-cache"`** -- Yanıtı HTTP önbelleğinden alır hatta eskimiş olsa bile. Eğer HTTP önbelleğinde yanıt yoksa normal bir HTTP isteği yapar ve normal davranır;
131
+
-**`"only-if-cached"`** -- Yanıtı HTTP önbelleğinden alır hatta eskimiş olsa bile. Eğer HTTP önbelleğinde yanıt yoksa hata döner. Sadece `mode`değeri`"same-origin"` olduğunda çalışır.
133
132
134
133
## redirect
135
134
136
-
Normally,`fetch`transparently follows HTTP-redirects, like 301, 302 etc.
135
+
Normalde`fetch`işlemi 301, 302 gibi HTTP yönlendirmelerini şeffaf bir şekilde takip eder.
137
136
138
-
The `redirect`option allows to change that:
137
+
`redirect`seçeneği bu davranışı değiştirmemizi sağlar:
139
138
140
-
-**`"follow"`** -- the default, follow HTTP-redirects,
141
-
-**`"error"`** -- error in case of HTTP-redirect,
142
-
-**`"manual"`** -- don't follow HTTP-redirect, but `response.url`will be the new URL, and `response.redirected`will be `true`, so that we can perform the redirect manually to the new URL (if needed).
139
+
-**`"follow"`** -- Varsayılan değerdir, HTTP yönlendirmelerini takip eder,
140
+
-**`"error"`** -- HTTP yönlendirmesi durumunda hata verir,
141
+
-**`"manual"`** -- HTTP yönlendirmelerini takip etmez ancak `response.url`yeni URL olacak ve `response.redirected`değeri `true` olacak böylece ihtiyaç halinde yönlendirmeyi manuel olarak yeni URL'ye gerçekleştirebiliriz.
143
142
144
143
## integrity
145
144
146
-
The `integrity` option allows to check if the response matches the known-ahead checksum.
145
+
`integrity`, yanıtın önceden bilinen bir karma (checksum) ile eşleşip eşleşmediğini kontrol etmemize olanak sağlar.
147
146
148
-
As described in the [specification](https://w3c.github.io/webappsec-subresource-integrity/), supported hash-functions are SHA-256, SHA-384, and SHA-512, there might be others depending on a browser.
147
+
[specification](https://w3c.github.io/webappsec-subresource-integrity/)'da açıklandığı gibi, desteklenen fonksiyonlar SHA-256, SHA-384 ve SHA-512'dir ve tarayıcıya göre başka fonksiyonları da olabilir.
149
148
150
-
For example, we're downloading a file, and we know that it's SHA-256 checksum is "abc" (a real checksum is longer, of course).
149
+
Örneğin bir dosyayı indiriyoruz ve dosyanın SHA-256 karma değerinin "abc" olduğunu biliyoruz (gerçek bir karma değeri tabii ki daha uzundur).
151
150
152
-
We can put it in the `integrity`option, like this:
151
+
Bunu aşağıdaki gibi `integrity`seçeneğine ekleyebiliriz:
153
152
154
153
```js
155
154
fetch('http://site.com/file', {
156
155
integrity:'sha256-abd'
157
156
});
158
157
```
159
158
160
-
Then `fetch`will calculate SHA-256 on its own and compare it with our string. In case of a mismatch, an error is triggered.
159
+
Daha sonra `fetch`işlemi kendi başına SHA-256 hesaplar ve hesapladığı değeri bizim verdiğimiz değerle karşılaştırır. Eşleşme olmaması durumunda bir hata tetiklenir.
161
160
162
161
## keepalive
163
162
164
-
The `keepalive` option indicates that the request may outlive the page.
163
+
`keepalive`, isteğin sayfadan ayrıldıktan sonra dahi gerçekleştirilebileceğini belirtir.
165
164
166
-
For example, we gather statistics about how the current visitor uses our page (mouse clicks, page fragments he views), to improve user experience.
165
+
Örneğin mevcut ziyaretçinin sayfamızı nasıl kullandığıyla ilgili istatistikleri topluyoruz (fare tıklamaları, görüntülediği sayfa parçaları) ve kullanıcı deneyimini iyileştirmek amacıyla bunları sunucumuza kaydetmek istiyoruz.
167
166
168
-
When the visitor leaves our page -- we'd like to save it on our server.
167
+
Ziyaretçi sayfadan ayrıldığında bu bilgileri sunucumuza kaydetmek istiyoruz.
169
168
170
-
We can use`window.onunload`for that:
169
+
Bunu yapmak için`window.onunload`özelliğini kullanabiliriz:
Normally, when a document is unloaded, all associated network requests are aborted. But `keepalive`option tells the browser to perform the request in background, even after it leaves the page. So it's essential for our request to succeed.
183
+
Normalde bir belge yüklenirken ilişkili tüm ağ istekleri iptal edilir ancak `keepalive`tarayıcının isteği arka planda yapmasını ve sayfadan ayrıldıktan sonra bile gerçekleştirmesini sağlar. Bu nedenle isteğin başarıyla gerçekleşmesi için bu seçeneğin kullanılması önemlidir.
185
184
186
-
-We can't send megabytes: the body limit for keepalive requests is 64kb.
187
-
-If we gather more data, we can send it out regularly, then there won't be a lot for the "onunload" request.
188
-
-The limit is for all currently ongoing requests. So we cheat it by creating 100 requests, each 64kb.
189
-
-We don't get the server response if the request is made `onunload`, because the document is already unloaded at that time.
190
-
-Usually, the server sends empty response to such requests, so it's not a problem.
185
+
-Megabaytlarca veri gönderemeyiz: `keepalive` istekleri için sınır 64 KB'dır
186
+
-Daha fazla veri toplarsak düzenli olarak göndermemiz gerekir böylece "onunload" isteği için çok fazla veri olmaz.
187
+
- Limit tüm devam eden istekler için geçerlidir. Bu nedenle 64 KB boyutunda 100 istek oluşturarak bu sınırı aşabiliriz.
188
+
-`onunload` durumunda sunucu cevabını alamayız çünkü belge o zaman zaten yüklenmemiştir.
189
+
-Genellikle sunucu böyle isteklere boş bir cevap gönderir bu nedenle bu durumda bir sorun olmaz.
0 commit comments