tall-plugin-meta-refresh
TypeScript icon, indicating that this package has built-in type declarations

8.0.0 • Public • Published

tall-plugin-meta-refresh

A plugin for tall that allows you to follow meta refresh redirects such as:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>The Tudors</title>
    <meta
      http-equiv="refresh"
      content="3;URL='http://thetudors.example.com/'"
    />
  </head>
  <body>
    <p>
      This page has moved to
      <a href="http://thetudors.example.com/">theTudors.example.com</a>.
      Redirecting you automatically in 3 seconds.
    </p>
  </body>
</html>

Example from W3C.

Installation

With npm:

npm i --save tall-plugin-meta-refresh

or with yarn:

yarn add tall-plugin-meta-refresh

Usage

To enable the plugin on a given tall instance:

import { locationHeaderPlugin, tall } from 'tall'
import { metaRefreshPlugin } from 'tall-plugin-meta-refresh'

const url = await tall('https://example.com/a-link', {
  plugins: [locationHeaderPlugin, metaRefreshPlugin]
})

console.log(url)

Note: the locationHeaderPlugin is the standard behavior (following HTTP header location headers) and it should always be used before the metaRefreshPlugin.

Warning: also be aware that the metaRefreshPlugin will consume the entire HTTP response object, so other plugins that might be added after it won't be able to parse the response body.

Package Sidebar

Install

npm i tall-plugin-meta-refresh

Weekly Downloads

108

Version

8.0.0

License

MIT

Unpacked Size

11.6 kB

Total Files

9

Last publish

Collaborators

  • lmammino