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: 5-network/06-url/article.md
+36-37Lines changed: 36 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,23 @@
1
1
2
-
# URL objects
2
+
# URL yapısı
3
3
4
-
The built-in [URL](https://url.spec.whatwg.org/#api) class provides a convenient interface for creating and parsing URLs.
5
4
6
-
There are no networking methods that require exactly an `URL` object, strings are good enough. So technically we don't have to use `URL`. But sometimes it can be really helpful.
5
+
Yerleşik [URL](https://url.spec.whatwg.org/#api) sınıfı, URL'leri oluşturmak ve ayrıştırmak için uygun bir arayüz sağlar.
7
6
8
-
## Creating an URL
7
+
Tam olarak bir `URL` nesnesi gerektiren ağ oluşturma yöntemi yoktur, dizeler(strings) yeterince iyidir. Yani teknik olarak `URL` kullanmak zorunda değiliz. Ama bazen gerçekten yardımcı olabilir.
9
8
10
-
The syntax to create a new URL object:
9
+
## URL oluşturma
10
+
11
+
Yeni bir URL nesnesi oluşturmak için sözdizimi:
11
12
12
13
```js
13
14
newURL(url, [base])
14
15
```
15
16
16
-
-**`url`** -- the URL string or path (if base is set, see below).
17
-
-**`base`** -- an optional base, if set and `url` has only path, then the URL is generated relative to `base`.
17
+
-**`url`** -- URL'nin dizesi veya yolu (temel ayarlanmışsa, aşağıya bakın).
18
+
-**`base`** -- isteğe bağlı, base ayarlanmış ve `url`'de yalnızca yol varsa bu durumda URL `base`'e göre yani tabana göre oluşturulur.
18
19
19
-
For example, these two URLs are same:
20
+
Örneğin, bu iki URL aynı:
20
21
21
22
```js run
22
23
let url1 =newURL('https://javascript.info/profile/admin');
-`search` - a string of parameters, starts with the question mark`?`
56
-
-`hash`starts with the hash character`#`
57
-
-there are also `user`and`password`properties if HTTP authentication is present.
53
+
-`href`tam url, `url.toString()` ile aynı
54
+
-`protocol`iki nokta üst üste karakteri ile biter`:`
55
+
-`search` - bir dizi parametre, soru işaretiyle başlar`?`
56
+
-`hash`karma karakterle başlar`#`
57
+
-HTTP kimlik doğrulaması varsa `user`ve`password`özellikleri de vardır.
58
58
59
59
60
-
```smart header="We can use `URL` everywhere instead of a string"
61
-
We can use an `URL` object in `fetch` or `XMLHttpRequest`, almost everywhere where a string url is expected.
60
+
```smart header="Bir string yerine her yerde `URL` kullanabiliriz"
61
+
`fetch` veya `XMLHttpRequest`'te, bir string url'nin beklendiği hemen hemen her yerde bir `URL` nesnesi kullanabiliriz.
62
+
63
+
Yöntemlerin büyük çoğunluğunda otomatik olarak bir stringe dönüştürülür.
62
64
63
-
In the vast majority of methods it's automatically converted to a string.
64
-
```
65
65
66
-
## SearchParams "?..."
66
+
## Arama Parametreleri "?..."
67
67
68
-
Let's say we want to create an url with given search params, for instance, `https://google.com/search?query=JavaScript`.
68
+
Verilen arama parametreleriyle bir url oluşturmak istediğimizi varsayalım, örneğin, `https://google.com/search?query=JavaScript`.
69
69
70
-
They must be correctly encoded to include non-latin charcters, spaces etc.
70
+
Latin olmayan karakterleri, boşlukları vb. içerecek şekilde doğru kodlanmaları gerekir.
71
71
72
-
Some time ago, before `URL` objects appeared, we'd use built-in functions `encodeURIComponent/decodeURIComponent`. They have some problems, but now that doesn't matter.
72
+
Bir süre önce, `URL`nesneler ortaya çıkmadan önce yerleşik işlevleri kullanırdık encodeURIComponent/decodeURIComponent. Bazı sorunları var ama artık bu önemli değil.
73
73
74
-
There's URL property for that: `url.searchParams` is an object of type [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams).
74
+
Bunun için URL özelliği var: `url.searchParams`bu [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams) türünde bir nesnedir.
75
75
76
-
It provides convenient methods for search parameters:
76
+
Arama parametreleri için uygun yöntemler sağlar:
77
77
78
-
- **`append(name, value)`** -- add the parameter,
79
-
- **`delete(name)`** -- remove the parameter,
80
-
- **`get(name)`** -- get the parameter,
81
-
- **`getAll(name)`** -- get all parameters with that name (if many, e.g. `?user=John&user=Pete`),
82
-
- **`has(name)`** -- check for the existance of the parameter,
83
-
- **`set(name, value)`** -- set/replace the parameter,
84
-
- **`sort()`** -- sort parameters by name, rarely needed,
85
-
- ...and also iterable, similar to `Map`.
78
+
-**`append(name, value)`** -- parametre ekleme,
79
+
-**`delete(name)`** -- parametreyi silme,
80
+
-**`get(name)`** -- parametreyi alma,
81
+
-**`getAll(name)`** -- bu isimdeki tüm parametreleri al (eğer çoksa örnek: `?user=John&user=Pete`),
82
+
-**`has(name)`** -- parametrenin varlığını kontrol etme,
0 commit comments