script

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

README

script

Types

type Script

type Script struct { ... }

func (*Script) WriteTo

func (s *Script) WriteTo(w io.Writer) (n int64, err error)


Readme created from Go doc with goreadme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset string

type CrossOrigin

type CrossOrigin int
const (
	DefaultCrossOrigin CrossOrigin = iota
	Anonymous
	// UseCredentials The browser will send cookies along with the request.
	UseCredentials
)

func (CrossOrigin) String

func (i CrossOrigin) String() string

type Priority

type Priority int
const (
	Auto Priority = iota
	High
	Low
)

func (Priority) String

func (i Priority) String() string

type ReferrerPolicy

type ReferrerPolicy int
const (
	// None dont set any priority
	None ReferrerPolicy = iota
	// NoReferrer The Referer header will not be sent.
	NoReferrer
	// NoneWhenDowngrade The Referer header will not be sent to origins without TLS (HTTPS).
	NoReferrerWhenDowngrade
	// Origin The sent referrer will be limited to the origin of the referring page: its scheme, host, and port.
	Origin
	// OriginWhenCrossOrigin The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.
	OriginWhenCrossOrigin
	// SameOrigin A referrer will be sent for same origin, but cross-origin requests will contain no referrer information.
	SameOrigin
	// StrictOrigin Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don't send it to a less secure destination (HTTPS→HTTP).
	StrictOrigin
	// StrictOriginWhenCrossOrigin Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).
	StrictOriginWhenCrossOrigin
	// UnsafeURL The referrer will include the origin and the path (but not the fragment, password, or username). This value is unsafe, because it leaks origins and paths from TLS
	UnsafeURL
)

func (ReferrerPolicy) String

func (i ReferrerPolicy) String() string

type Script

type Script struct {

	// Content is the content of the script
	Content string
	// Src is the source of the script
	// If both Content and Src are set, two scripts will be rendered
	Src string
	// Type will default to module. If you want to use old script, set it to text/javascript
	Type           string
	Blocking       string
	Async          bool
	CrossOrigin    CrossOrigin
	Defer          bool
	Priority       Priority
	Integrity      string
	Nonce          string
	Referrerpolicy ReferrerPolicy
	NoModule       bool
	Data           map[string]string
}

func New

func New(arg any) Script

func (*Script) Element

func (s *Script) Element() io.WriterTo

func (*Script) WriteTo

func (s *Script) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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