열거형을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. 예를 들면
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월 이전에 기본값이었습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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. |"]]