next/script

The Next.js Script component, which loads third-party JavaScript with a chosen strategy so it does not block the page.

In more detail

The strategy prop is beforeInteractive, afterInteractive (default), lazyOnload or the experimental worker. A script is loaded only once even if several pages include it.

Example

<Script src="https://example.com/widget.js" strategy="lazyOnload" />

Related terms

Taught in

References