10000 GitHub - forthedamn/safe-window-location: location parent(top) window safely in koa
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

forthedamn/safe-window-location

Repository files navigation

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');
})
param usage required default
ctx koa context yes
location window location, like https://www.npmjs.com - /
target window target, like window.parent - parent
config name config option name - whiteList

About

location parent(top) window safely in koa

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0