1.0.4 • Published 6 years ago

safe-window-location v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

safe-window-location

NPM version build status code coverage license

redirect parent(top) window location safely

Install

npm install safe-window-location

yarn add safe-window-location

Usage

// ./config/default.js

module.exports = {
  urlWhiteList: [
    /**
     * allow the hostname end with 'github.com'
     * like 'https://github.com/**'
     */
    /github\.com$/
  ]
}
const SafeWindowLocation = require('safe-window-location');

const app = new Koa();
app.use((ctx, next) => {
  // set parent window as new location
  return SafeWindowLocation(ctx, 'new location', 'parent', 'urlWhiteList');
})
paramusagerequireddefault
ctxkoa contextyes
locationwindow location, like https://www.npmjs.com-/
targetwindow target, like window.parent-parent
config nameconfig option name-whiteList
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago