Enum SandboxMode
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
샌드박스모드
클라이언트 측 HtmlService
스크립트에 사용할 수 있는 샌드박스 모드를 나타내는 enum입니다. 이러한 값은 HtmlService.SandboxMode
에서 액세스할 수 있으며 HtmlOutput.setSandboxMode(mode)
를 호출하여 설정할 수 있습니다.
열거형을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. 예를 들면
HtmlService.SandboxMode.IFRAME
입니다.
NATIVE
및 EMULATED
모드는
2015년 10월 13일에 지원 중단되었으며 현재 모두 서비스가 종료되었습니다. 이제 IFRAME
모드만 지원됩니다.
악성 HTML 또는 JavaScript가 사용자에게 제공되지 않도록 HTML 서비스에서 제공되는 클라이언트 측 코드는 코드에 제한을 적용하는 보안 샌드박스에서 실행됩니다. 이전에는 HtmlOutput.setSandboxMode(mode)
메서드를 통해 스크립트 작성자가 다양한 버전의 샌드박스 중에서 선택할 수 있었지만 이제는 아무런 영향을 미치지 않습니다. 자세한 내용은 HTML 서비스 제한사항 가이드를 참고하세요.
IFRAME
모드는 다른 샌드박스 모드보다 제한사항이 훨씬 적고 가장 빠르게 실행되지만 Internet Explorer 9를 비롯한 일부 이전 브라우저에서는 전혀 작동하지 않습니다. 샌드박스 모드는 google.script.sandbox.mode
를 검사하여 클라이언트 측 스크립트에서 읽을 수도 있습니다. 이 속성은 클라이언트의 실제 모드를 반환하며, 요청된 모드가 사용자의 브라우저에서 지원되지 않는 경우 서버에서 요청된 모드와 다를 수 있습니다.
<!-- Read the sandbox mode (in a client-side script). -->
<script>
alert(google.script.sandbox.mode);
</script>
속성
속성 | 유형 | 설명 |
EMULATED | Enum | ECMAScript 3에서 사용할 수 있는 기능만 사용하여 ECMAScript 5 엄격 모드를 에뮬레이션하는 기존 샌드박스 모드입니다. 이 모드는 2014년 2월 이전에 기본값이었습니다.
EMULATED 는 2015년 12월 10일부로 지원이 종료되었습니다. EMULATED 을 사용하려는 모든 스크립트가 이제 IFRAME 을 대신 사용합니다.
|
IFRAME | Enum | EMULATED 및 NATIVE 모드에서 사용되는 Caja 샌드박스 기술 대신 iframe 샌드박스를 사용하는 샌드박스 모드입니다. 이 모드는 2015년 11월 12일 이후의 새 스크립트와 2016년 7월 6일 이후의 모든 스크립트의 기본값입니다.
이 모드는 다른 샌드박스 모드보다 제한사항이 훨씬 적고 가장 빠르게 실행되지만 Internet Explorer 9를 비롯한 일부 이전 브라우저에서는 전혀 작동하지 않습니다.
|
NATIVE | Enum | ECMAScript 5 엄격 모드를 기반으로 빌드된 샌드박스 모드입니다. ECMAScript 5 엄격 모드를 기반으로 빌드된 샌드박스 모드입니다. 이 모드는 2016년 7월 6일에 지원이 종료되었습니다. 이제 모든 스크립트가 IFRAME 모드를 사용합니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-04(UTC)
[null,null,["최종 업데이트: 2025-08-04(UTC)"],[[["\u003cp\u003eSandboxMode is used for setting the sandbox environment for client-side HtmlService scripts in Google Apps Script.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIFRAME\u003c/code\u003e is the only supported SandboxMode; \u003ccode\u003eNATIVE\u003c/code\u003e and \u003ccode\u003eEMULATED\u003c/code\u003e are deprecated and sunset.\u003c/p\u003e\n"],["\u003cp\u003eClient-side code in HTML service runs in a security sandbox with restrictions to protect users.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIFRAME\u003c/code\u003e mode has fewer restrictions and runs faster but might not work in older browsers like Internet Explorer 9.\u003c/p\u003e\n"],["\u003cp\u003eYou can read the actual sandbox mode on the client-side using \u003ccode\u003egoogle.script.sandbox.mode\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Enum SandboxMode\n\nSandboxMode\n\nAn enum representing the sandbox modes that can be used for client-side [HtmlService](/apps-script/reference/html/html-service)\nscripts. These values can be accessed from [HtmlService.SandboxMode](/apps-script/reference/html/html-service#SandboxMode), and set by calling\n[HtmlOutput.setSandboxMode(mode)](/apps-script/reference/html/html-output#setSandboxMode(SandboxMode)).\n\nTo call an enum, you call its parent class, name, and property. For example, `\nHtmlService.SandboxMode.IFRAME`.\n\nThe `NATIVE` and `EMULATED` modes were [deprecated on October 13, 2015](https://workspace.google.com/blog/product-announcements/google-apps-script-update-htmlservice) and both are now sunset. Only `IFRAME` mode is now\nsupported.\n\nTo protect users from being served malicious HTML or JavaScript, client-side code served from\nHTML service executes in a security sandbox that imposes restrictions on the code. The method\n[HtmlOutput.setSandboxMode(mode)](/apps-script/reference/html/html-output#setSandboxMode(SandboxMode)) previously allowed script authors to choose\nbetween different versions of the sandbox, but now has no effect. For more information, see the\n[guide to restrictions in HTML service](/apps-script/guides/html/restrictions).\n\nThe `IFRAME` mode imposes many fewer restrictions than the other sandbox modes and runs\nfastest, but does not work at all in certain older browsers, including Internet Explorer 9. The\nsandbox mode can also be read in a client-side script by inspecting `google.script.sandbox.mode`. Note that this property returns the actual mode on the client, which\nmay differ from the mode requested on the server if the requested mode is not supported in the\nuser's browser.\n\n```html\n\u003c!-- Read the sandbox mode (in a client-side script). --\u003e\n\u003cscript\u003e\n alert(google.script.sandbox.mode);\n\u003c/script\u003e\n``` \n\n### Properties\n\n| Property | Type | Description |\n|------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `EMULATED` | `Enum` | A legacy sandbox mode that emulates ECMAScript 5 strict mode using only the features available in ECMAScript 3. This mode was the default prior to February 2014. `EMULATED` was [sunset as of December 10, 2015](/apps-script/guides/support/sunset). All scripts attempting use `EMULATED` will now use `IFRAME` instead. |\n| `IFRAME` | `Enum` | A sandbox mode that uses iframe sandboxing instead of the Caja sandbox technology used by the `EMULATED` and `NATIVE` modes. This mode is the default for new scripts as of November 12, 2015 and for all scripts as of July 6, 2016. This mode imposes many fewer restrictions than the other sandbox modes and runs fastest, but does not work at all in certain older browsers, including Internet Explorer 9. |\n| `NATIVE` | `Enum` | A sandbox mode that is built on top of ECMAScript 5 strict mode. A sandbox mode built on top of ECMAScript 5 strict mode. This mode was [sunset as of July 6, 2016](/apps-script/guides/support/sunset). All scripts now use `IFRAME` mode. |"]]