برای فراخوانی یک enum، کلاس والد، نام و ویژگی آن را فراخوانی می کنید. به عنوان مثال، HtmlService.SandboxMode.IFRAME .
حالتهای NATIVE و EMULATEDدر 13 اکتبر 2015 منسوخ شدند و هر دو اکنون غروب هستند. اکنون فقط حالت IFRAME پشتیبانی می شود.
برای محافظت از کاربران در برابر ارائه HTML یا جاوا اسکریپت مخرب، کد سمت سرویس گیرنده ارائه شده از سرویس HTML در یک جعبه ایمنی امنیتی اجرا می شود که محدودیت هایی بر روی کد اعمال می کند. روش Html Output.setSandboxMode(mode) قبلاً به نویسندگان اسکریپت اجازه می داد بین نسخه های مختلف جعبه ایمنی یکی را انتخاب کنند، اما اکنون هیچ تأثیری ندارد. برای اطلاعات بیشتر، راهنمای محدودیت ها در سرویس HTML را ببینید.
حالت IFRAME محدودیتهای بسیار کمتری نسبت به سایر حالتهای جعبه ایمنی اعمال میکند و سریعتر اجرا میشود، اما در برخی از مرورگرهای قدیمیتر، از جمله Internet Explorer 9، اصلاً کار نمیکند. حالت sandbox را نیز میتوان در یک اسکریپت سمت سرویس گیرنده با بررسی google.script.sandbox.mode خواند. توجه داشته باشید که این ویژگی حالت واقعی را بر روی کلاینت برمی گرداند، که اگر حالت درخواستی در مرورگر کاربر پشتیبانی نشود، ممکن است با حالت درخواست شده در سرور متفاوت باشد.
<!-- Read the sandbox mode (in a client-side script). -->
<script>
alert(google.script.sandbox.mode);
</script>
خواص
اموال
تایپ کنید
توضیحات
EMULATED
Enum
یک حالت سندباکس قدیمی که حالت سختگیرانه ECMAScript 5 را فقط با استفاده از ویژگیهای موجود در ECMAScript 3 تقلید میکند. این حالت پیشفرض قبل از فوریه 2014 بود.
EMULATEDدر 10 دسامبر 2015 غروب شد. همه اسکریپت هایی که سعی در استفاده EMULATED دارند، اکنون به جای آن از IFRAME استفاده می کنند.
IFRAME
Enum
حالت Sandbox که از sandboxing iframe به جای فناوری Caja sandbox استفاده میکند که توسط حالتهای EMULATED و NATIVE استفاده میشود. این حالت برای اسکریپت های جدید از 12 نوامبر 2015 و برای همه اسکریپت ها از 6 ژوئیه 2016 پیش فرض است.
این حالت محدودیتهای بسیار کمتری نسبت به سایر حالتهای جعبه ایمنی اعمال میکند و سریعترین اجرا را دارد، اما در برخی از مرورگرهای قدیمیتر، از جمله Internet Explorer 9، اصلاً کار نمیکند.
NATIVE
Enum
حالت sandbox که بر روی حالت سخت ECMAScript 5 ساخته شده است. حالت جعبه ایمنی که در بالای حالت سخت ECMAScript 5 ساخته شده است. این حالت در تاریخ 6 ژوئیه 2016 غروب شد. اکنون همه اسکریپت ها از حالت IFRAME استفاده می کنند.
تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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 بهوقت ساعت هماهنگ جهانی."],[[["\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,["SandboxMode\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\nProperties\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. |"]]