انتقل إلى المحتوى

لم تُترجم هذه الصفحة بعد، لذا تُعرض بالإنجليزية.

URL

How Elide supports the URL and URLSearchParams globals per the URL Standard, including URL.parse(), URL.canParse() and the live searchParams object.

اقرأ دون اتصالelide help api-whatwg-url

في هذه الصفحة
الاستخدام مع الذكاء الاصطناعي
افتح في ChatGPTافتح في Claude

URL is a global and follows the URL Standard, including URL.parse() and URL.canParse().

Example

js
// weburl.mjs
const url = new URL("../docs?page=2#intro", "https://elide.dev/guide/start");
console.log(url.href);
console.log(url.pathname, url.searchParams.get("page"), url.hash);

url.searchParams.append("tag", "node");
url.searchParams.sort();
console.log(url.search);
console.log(URL.canParse("not a url"), URL.parse("http://[::1]:8080/")?.host);
utf-8 · js · Lines: 9

elide run weburl.mjs prints:

text
https://elide.dev/docs?page=2#intro
/docs 2 #intro
?page=2&tag=node
false [::1]:8080
utf-8 · text · Lines: 4

URLSearchParams

URLSearchParams is a global and follows the same standard. url.searchParams returns the same live object on every access.

Reference

Status: Full · 8,682 of 9,046 suite tests pass (96.0%) · since 1.1.0

Exports

ExportKindStatusNotes
URLclassFullURL.parse(), URL.canParse(), href, origin, protocol, username, password, host, hostname, port, pathname, search, searchParams, hash, toJSON()
URLSearchParamsclassFullsize, append(), delete(), get(), getAll(), has(), set(), sort(), iteration

Tests: wpt-wintertc url: 8,682 pass, 364 fail, 0 error, 2,251 skipped. Failing: url/toascii.window.js (298), url/IdnaTestV2.any.js (30), url/url-constructor.any.js (12), url/url-setters.any.js (12), url/urlsearchparams-constructor.any.js (6), url/urlencoded-parser.any.js (2), url/idlharness.any.js, url/url-origin.any.js, and 2 more.

هل كانت هذه الصفحة مفيدة؟