| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/API/URL_API | [Back] [Original] |
Get to know MDN better
URL API URL Uniform Resource Locator URL API URL IP / application/x-www-form-urlencoded MIME
URL URL IP DOM API
URL URL URL
let addr = new URL("https://developer.mozilla.org/ja/docs/Web/API/URL_API");
let host = addr.host;
let path = addr.pathname;
URL host pathname developer.mozilla.org /ja/docs/Web/API/URL_API
URL URL URL
let myUsername = "someguy";
let addr = new URL("https://example.com/login");
addr.username = myUsername;
username URL href https://someguy@example.com/login
URL search URL URL https://example.com/login?user=someguy&page=news search ?user=someguy&page=news URLSearchParams get()
let addr = new URL("https://example.com/login?user=someguy&page=news");
try {
loginUser(addr.searchParams.get("user"));
gotoPage(addr.searchParams.get("page"));
} catch (err) {
showErrorMessage(err);
}
URLSearchParams
URL API API 2
URLURLSearchParamsURL
URL URL fillTableWithParameters() <table> HTMLTableElement 2
function fillTableWithParameters(tbl) {
const url = new URL(document.location.href);
url.searchParams.sort();
const keys = url.searchParams.keys();
for (const key of keys) {
const val = url.searchParams.get(key);
const row = document.createElement("tr");
const cell1 = document.createElement("td");
cell1.innerText = key;
row.appendChild(cell1);
const cell2 = document.createElement("td");
cell2.innerText = val;
row.appendChild(cell2);
tbl.appendChild(row);
}
}
Glitch URL https://url-api.glitch.me?from=mdn&excitement=high&likelihood=inconceivable
| URL # api |
| Web Proxy Viewer | New URL | Original Page |