From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- files/ru/web/api/url/createobjecturl/index.html | 66 +++++++++++++ files/ru/web/api/url/index.html | 119 +++++++++++++++++++++++ files/ru/web/api/url/url/index.html | 121 ++++++++++++++++++++++++ 3 files changed, 306 insertions(+) create mode 100644 files/ru/web/api/url/createobjecturl/index.html create mode 100644 files/ru/web/api/url/index.html create mode 100644 files/ru/web/api/url/url/index.html (limited to 'files/ru/web/api/url') diff --git a/files/ru/web/api/url/createobjecturl/index.html b/files/ru/web/api/url/createobjecturl/index.html new file mode 100644 index 0000000000..bff6b425d5 --- /dev/null +++ b/files/ru/web/api/url/createobjecturl/index.html @@ -0,0 +1,66 @@ +--- +title: URL.createObjectURL() +slug: Web/API/URL/createObjectURL +translation_of: Web/API/URL/createObjectURL +--- +

{{ApiRef("URL")}}{{SeeCompatTable}}

+ +

Определение

+ +

URL.createObjectURL() - статический метод, который создает {{domxref("DOMString")}}, содержащий URL с указанием на объект, заданный как параметр. Время жизни URL связано с {{domxref("document")}} окна в котором он был создан. Новый URL объект может представлять собой {{domxref("File")}} объект или {{domxref("Blob")}} объект.

+ +

{{AvailableInWorkers}}

+ +

Синтаксис

+ +
objectURL = URL.createObjectURL(blob);
+
+ +

Параметры

+ +
+
blob
+
+ +
+
Объект типа {{domxref("File")}} или {{domxref("Blob")}} для которого создается URL объект.
+
+ + + +

Пример

+ +

Смотрите Using object URLs to display images.

+ +

Заметки

+ +

При каждом вызове createObjectURL(), создается новый URL объект, даже если он уже был ранее создан для того же самого объекта. Память для каждого из них нужно освобождать с помощью {{domxref("URL.revokeObjectURL()")}}, в том случае, если они больше не нужны. Браузер сделает это автоматически с выгрузкой объекта, тем не менее в целях оптимизации производительности и использования памяти, следует принудительно выгружать их по возможности.

+ +

Спецификации

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('File API', '#dfn-createObjectURL', 'URL')}}{{Spec2('File API')}}Initial definition.
+ +

Поддержка браузерами

+ +

{{Compat("api.URL.createObjectURL")}}

+ +

См. также

+ + diff --git a/files/ru/web/api/url/index.html b/files/ru/web/api/url/index.html new file mode 100644 index 0000000000..7ba8f09324 --- /dev/null +++ b/files/ru/web/api/url/index.html @@ -0,0 +1,119 @@ +--- +title: URL +slug: Web/API/URL +tags: + - API + - Experimental + - NeedsTranslation + - TopicStub + - URL API +translation_of: Web/API/URL +--- +
{{ApiRef("URL API")}} {{SeeCompatTable}}
+ +

The URL interface represent an object providing static methods used for creating object URLs.

+ +

When using a user agent where no constructor has been implemented yet, it is possible to access such an object using the {{domxref("Window.URL")}} properties (prefixed with Webkit-based browser as Window.webkitURL).

+ +

{{AvailableInWorkers}}

+ +

Свойства

+ +

Implements properties defined in {{domxref("URLUtils")}}.

+ +
+
{{domxref("URLUtils.href")}}
+
Is a {{domxref("DOMString")}} containing the whole URL.
+
{{domxref("URLUtils.protocol")}}
+
Is a {{domxref("DOMString")}} containing the protocol scheme of the URL, including the final ':'.
+
{{domxref("URLUtils.host")}}
+
Is a {{domxref("DOMString")}} containing the host, that is the hostname, a ':', and the port of the URL.
+
{{domxref("URLUtils.hostname")}}
+
Is a {{domxref("DOMString")}} containing the domain of the URL.
+
{{domxref("URLUtils.port")}}
+
Is a {{domxref("DOMString")}} containing the port number of the URL.
+
{{domxref("URLUtils.pathname")}}
+
Is a {{domxref("DOMString")}} containing an initial '/' followed by the path of the URL.
+
{{domxref("URLUtils.search")}}
+
Is a {{domxref("DOMString")}} containing a '?' followed by the parameters of the URL.
+
{{domxref("URLUtils.hash")}}
+
Is a {{domxref("DOMString")}} containing a '#' followed by the fragment identifier of the URL.
+
{{domxref("URLUtils.username")}}
+
Is a {{domxref("DOMString")}} containing the username specified before the domain name.
+
{{domxref("URLUtils.password")}}
+
Is a {{domxref("DOMString")}} containing the password specified before the domain name.
+
{{domxref("URLUtils.origin")}} {{readonlyInline}}
+
Returns a {{domxref("DOMString")}} containing the origin of the URL, that is its scheme, its domain and its port.
+
+ +
+
{{domxref("URLUtils.searchParams")}}
+
Returns a {{domxref("URLSearchParams")}} object allowing to access the GET query arguments contained in the URL.
+
+ +

Конструктор

+ +
+
{{domxref("URL.URL", "URL()")}}
+
Creates and return a URL object composed from the given parameters.
+
+ +

Методы

+ +

The URL interface implements methods defined in {{domxref("URLUtils")}}.

+ +
+
{{domxref("URLUtils.toString()")}}
+
Returns a {{domxref("DOMString")}} containing the whole URL. It is a synonym for {{domxref("URLUtils.href")}}, though it can't be used to modify the value.
+
+ +

Статические методы

+ +
+
{{domxref("URL.createObjectURL()")}}
+
Returns a {{domxref("DOMString")}} containing a unique blob URL, that is a URL with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser.
+
{{domxref("URL.revokeObjectURL()")}}
+
Revokes an object URL previously created using {{domxref("URL.createObjectURL()")}}.
+
+ +

Спецификации

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('File API', '#creating-revoking', 'URL')}}{{Spec2('File API')}}Добавлены статические методы URL.createObjectURL(), URL.revokeObjectURL().
{{SpecName('URL', '#api', 'Node')}}{{Spec2('URL')}}Initial definition (implements URLUtils).
+ +

Поддержка браузерами

+ +

{{Compat("api.URL")}}

+ +

Chrome Code - Scope Availability

+ +

To use from chrome code, JSM and Bootstrap scope, you have to import it like this:

+ +
Cu.importGlobalProperties(['URL']);
+
+ +

URL is available in Worker scopes.

+ +

См. также

+ + diff --git a/files/ru/web/api/url/url/index.html b/files/ru/web/api/url/url/index.html new file mode 100644 index 0000000000..7907e088a8 --- /dev/null +++ b/files/ru/web/api/url/url/index.html @@ -0,0 +1,121 @@ +--- +title: URL() +slug: Web/API/URL/URL +translation_of: Web/API/URL/URL +--- +

{{SeeCompatTable}}{{APIRef("URL API")}}

+ +

Конструктор URL() возвращает вновь созданный  {{domxref("URL")}} объект отражающий URL определяемый параметрами.

+ +

If the given base URL or the resulting URL are not valid URLs, a {{domxref("DOMException")}} of type SYNTAX_ERROR is thrown.

+ +

{{AvailableInWorkers}}

+ +

Синтаксис

+ +
url = new URL(urlString, [baseURLstring])
+url = new URL(urlString, baseURLobject)
+
+ +

Параметры

+ +
+
urlString
+
Is a {{domxref("DOMString")}} representing an absolute or relative URL. If urlString is a relative URL, baseURLstring or baseURLobject, whichever is present, will be used as the base URL. If urlString is an absolute URL, baseURLstring and baseURLobject are ignored.
+
baseURLstring {{optional_inline}}
+
Is a {{domxref("DOMString")}} representing the base URL to use in case urlString is a relative URL. If not specified, and no baseURLobject is passed in parameters, it default to 'about:blank'. If it is an invalid absolute URL, the constructor will raise a {{domxref("DOMException")}} of type SYNTAX_ERROR
+
baseURLobject
+
Is a {{domxref("URL")}} object representing the base URL to use in case urlString is a relative URL.
+
+ +

Примеры

+ +
var a = new URL("/", "https://developer.mozilla.org"); // Creates a URL pointing to 'https://developer.mozilla.org/'
+var b = new URL("https://developer.mozilla.org");      // Creates a URL pointing to 'https://developer.mozilla.org/'
+var c = new URL('en-US/docs', b);                      // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
+var d = new URL('/en-US/docs', b);                     // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
+var f = new URL('/en-US/docs', d);                     // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
+var g = new URL('/en-US/docs', "https://developer.mozilla.org/fr-FR/toto");
+                                                       // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
+var h = new URL('/en-US/docs', a);                     // Creates a URL pointing to 'https://developer.mozilla.org/en-US/docs'
+var i = new URL('/en-US/docs', '');                    // Raises a SYNTAX ERROR exception as '/en-US/docs' is not valid
+var j = new URL('/en-US/docs');                        // Raises a SYNTAX ERROR exception as 'about:blank/en-US/docs' is not valid
+var k = new URL('http://www.example.com', 'https://developers.mozilla.com');
+                                                       // Creates a URL pointing to 'http://www.example.com/'
+var l = new URL('http://www.example.com', b);          // Creates a URL pointing to 'http://www.example.com/'
+
+ +

Спецификация

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('URL', '#constructors', 'URL.URL()')}}{{Spec2('URL')}}Initial definition.
+ +

Поддержка браузерами

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop("26.0")}}{{CompatNo}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}{{CompatGeckoMobile("26.0")}}{{CompatNo}}{{CompatUnknown}}{{CompatVersionUnknown}}
+
+ +

Смотрите также

+ + + +

 

-- cgit v1.2.3-54-g00ecf