URLSearchParams.append()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

URLSearchParams 인터페이스의 append() 메서드는 지정한 키/값 쌍을 새로운 검색 매개변수로서 추가합니다.

아래 예제에서도 볼 수 있듯, 같은 키를 여러 번 추가하면 매개변수 문자열에 각각의 키와 함께 여러 번 나타나게 됩니다.

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

구문

js
append(name, value);

매개변수

name

추가할 매개변수의 이름입니다.

value

추가할 매개변수의 값입니다.

반환 값

없음 (undefined).

예제

js
let url = new URL("https://example.com?foo=1&bar=2");
let params = new URLSearchParams(url.search);

// 두 번째 foo 매개변수 추가
params.append("foo", 4);
// 이제 쿼리 문자열이 'foo=1&bar=2&foo=4'

명세

Specification
URL
# dom-urlsearchparams-append

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
append

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기