This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

EventSource: withCredentials 속성

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020년 1월.

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

EventSource 인터페이스의 withCredentials 읽기 전용 속성은 EventSource 객체가 CORS 자격 증명이 설정된 상태로 인스턴스화되었는지 나타내는 불리언 값을 반환합니다.

값

EventSource 객체가 CORS 자격 증명이 설정된 상태로 인스턴스화되었는지(true) 또는 아닌지(false, 기본)를 나타내는 불리언 값.

예제

js
const evtSource = new EventSource("sse.php");
console.log(evtSource.withCredentials);

참고 : GitHub 에서 전체 예시를 확인할 수 있습니다. PHP를 사용한 간단한 SSE 데모를 확인하세요.

명세서

Specification
HTML
# dom-eventsource-withcredentials-dev

브라우저 호환성

같이 보기