iframe

package
v0.3.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<iframe")
	TagClose = []byte("</iframe>")

	AttrSrc             = []byte(" src=\"")
	AttrWidth           = []byte(" width=\"")
	AttrHeight          = []byte(" height=\"")
	AttrLoading         = []byte(" loading=\"")
	AttrAllow           = []byte(" allow=\"")
	AttrAllowFullscreen = []byte(" allowfullscreen")
	AttrName            = []byte(" name=\"")
	AttrReferrerPolicy  = []byte(" referrerpolicy=\"")
	AttrSandbox         = []byte(" sandbox=\"")
	AttrSrcDoc          = []byte(" srcdoc=\"")
	AttrCsp             = []byte(" csp=\"")
	AttrCredentialless  = []byte(" credentialless")
)

Byte constants for HTML rendering.

Functions

func Eager

func Eager(src string) *element

Eager Creates an iframe element with eager loading for immediate content display. Example: iframe.Eager("/critical-content.html") Renders: <iframe src="/critical-content.html" loading="eager"></iframe> Note: Iframe loads immediately, regardless of viewport position

func Lazy

func Lazy(src string) *element

Lazy Creates an iframe element with lazy loading enabled for improved performance. Example: iframe.Lazy("/page.html") Renders: <iframe src="/page.html" loading="lazy"></iframe> Note: Iframe will only load when it enters or is near the viewport

func New

func New(nodes ...node.Node) *element

New Creates a new iframe element with optional fallback content. Example: iframe.New().Src("/page.html") Renders: <iframe src="/page.html"></iframe>

func RawText

func RawText(str string) *element

RawText Creates a new iframe element with raw fallback content. Uses text.RawText which is not HTML-escaped. Example: iframe.RawText("<p>Fallback content</p>") Renders: <iframe><p>Fallback content</p></iframe>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf Creates a new iframe element with formatted raw fallback content. Uses text.RawTextf which is not HTML-escaped. Example: iframe.RawTextf("<p>Loading <strong>%s</strong>...</p>", page) Renders: <iframe><p>Loading <strong>Home</strong>...</p></iframe>

func Static

func Static(str string) *element

Static Creates a new iframe element with static fallback text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: iframe.Static("Loading embedded content...") Renders: <iframe>Loading embedded content...</iframe>

func Text

func Text(str string) *element

Text Creates a new iframe element with fallback text content. Uses text.Text which HTML-escapes the output. Example: iframe.Text("Your browser does not support iframes.") Renders: <iframe>Your browser does not support iframes.</iframe>

func Textf

func Textf(format string, args ...any) *element

Textf Creates a new iframe element with formatted fallback text content. Uses text.Textf which HTML-escapes the output. Example: iframe.Textf("Loading %s...", page) Renders: <iframe>Loading Home...</iframe>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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