IFRAME 模式的限制比其他沙箱模式少很多,且執行速度最快,但在某些舊版瀏覽器 (包括 Internet Explorer 9) 中完全無法運作。您也可以檢查 google.script.sandbox.mode,在用戶端指令碼中讀取沙箱模式。請注意,如果使用者瀏覽器不支援要求的模式,這項屬性會傳回用戶端的實際模式,而這可能與伺服器上要求的模式不同。
<!-- Read the sandbox mode (in a client-side script). -->
<script>
alert(google.script.sandbox.mode);
</script>
[[["容易理解","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"]],["上次更新時間:2024-12-22 (世界標準時間)。"],[[["SandboxMode is used for setting the sandbox environment for client-side HtmlService scripts in Google Apps Script."],["`IFRAME` is the only supported SandboxMode; `NATIVE` and `EMULATED` are deprecated and sunset."],["Client-side code in HTML service runs in a security sandbox with restrictions to protect users."],["`IFRAME` mode has fewer restrictions and runs faster but might not work in older browsers like Internet Explorer 9."],["You can read the actual sandbox mode on the client-side using `google.script.sandbox.mode`."]]],[]]