sandbox

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllowDownloads Allow downloads initiated by user interaction. Permits file downloads triggered by
	// user clicks or actions within the sandboxed iframe content.
	AllowDownloads = Sandbox("allow-downloads")

	// AllowForms Allow form submission within the sandboxed content. Permits forms to be submitted
	// to their action URLs from within the iframe.
	AllowForms = Sandbox("allow-forms")

	// AllowModals Allow modal dialogs like alert(), confirm(), and prompt(). Permits JavaScript dialogs
	// and modal windows to be displayed from the sandboxed content.
	AllowModals = Sandbox("allow-modals")

	// AllowOrientationLock Allow screen orientation locking on mobile devices. Permits the iframe content
	// to control device orientation for fullscreen applications or games.
	AllowOrientationLock = Sandbox("allow-orientation-lock")

	// AllowPointerLock Allow pointer lock API for mouse capture. Enables applications like games or drawing
	// tools to capture mouse movement without cursor constraints.
	AllowPointerLock = Sandbox("allow-pointer-lock")

	// AllowPopups Allow popup windows via window.open() or similar methods. Permits the sandboxed
	// content to open new browser windows or tabs.
	AllowPopups = Sandbox("allow-popups")

	// AllowPopupsToEscapeSandbox Allow popups to inherit full browser permissions. Popup windows opened from sandboxed
	// content will not be restricted by sandbox policies.
	AllowPopupsToEscapeSandbox = Sandbox("allow-popups-to-escape-sandbox")

	// AllowPresentation Allow presentation API for external displays. Permits content to use presentation
	// mode for projectors, secondary monitors, or casting devices.
	AllowPresentation = Sandbox("allow-presentation")

	// AllowSameOrigin Treat content as same-origin instead of unique origin. Allows access to cookies,
	// localStorage, and same-origin resources. Use carefully for security.
	AllowSameOrigin = Sandbox("allow-same-origin")

	// AllowScripts Allow JavaScript execution within sandboxed content. Permits scripts to run but
	// other sandbox restrictions still apply unless specifically allowed.
	AllowScripts = Sandbox("allow-scripts")

	// AllowStorageAccessByUserActivation Allow storage access API usage with user activation. Permits iframe to request
	// access to unpartitioned cookies through user interaction.
	AllowStorageAccessByUserActivation = Sandbox("allow-storage-access-by-user-activation")

	// AllowTopNavigation Allow navigation of top-level browsing context. Permits iframe to change the URL
	// of the parent page through navigation actions.
	AllowTopNavigation = Sandbox("allow-top-navigation")

	// AllowTopNavigationByUserActivation Allow top-level navigation only with user activation. Permits parent page navigation
	// but only when triggered by user interaction within iframe.
	AllowTopNavigationByUserActivation = Sandbox("allow-top-navigation-by-user-activation")

	// AllowTopNavigationToCustomProtocols Allow navigation to non-fetch scheme URLs like mailto: or tel: links. Permits
	// sandboxed content to trigger external protocol handlers through user interaction.
	AllowTopNavigationToCustomProtocols = Sandbox("allow-top-navigation-to-custom-protocols")
)

Variables for Sandbox values

Functions

This section is empty.

Types

type Sandbox

type Sandbox []byte

Sandbox Security restrictions for embedded iframe content. Creates sandboxed environment that limits potentially dangerous operations. Selective permissions can be granted via values.

func Custom

func Custom(value string) Sandbox

Custom allows setting a custom Sandbox value for edge cases or future specifications. Use this when the predefined constants don't cover your specific use case.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL