{"id":20302003,"url":"https://github.com/forthedamn/safe-window-location","last_synced_at":"2026-05-10T18:09:51.326Z","repository":{"id":65492318,"uuid":"115312597","full_name":"forthedamn/safe-window-location","owner":"forthedamn","description":"location parent(top) window safely in koa","archived":false,"fork":false,"pushed_at":"2018-06-27T06:07:23.000Z","size":97,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T16:18:32.306Z","etag":null,"topics":["koa","safe","safe-location","window","xss"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forthedamn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-25T06:30:36.000Z","updated_at":"2018-06-27T06:07:06.000Z","dependencies_parsed_at":"2023-01-25T19:35:12.593Z","dependency_job_id":null,"html_url":"https://github.com/forthedamn/safe-window-location","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthedamn%2Fsafe-window-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthedamn%2Fsafe-window-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthedamn%2Fsafe-window-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forthedamn%2Fsafe-window-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forthedamn","download_url":"https://codeload.github.com/forthedamn/safe-window-location/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241801192,"owners_count":20022383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["koa","safe","safe-location","window","xss"],"created_at":"2024-11-14T16:28:47.718Z","updated_at":"2026-05-10T18:09:51.297Z","avatar_url":"https://github.com/forthedamn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# safe-window-location\n[![NPM version][npm-image]][npm-url]\n[![build status](https://img.shields.io/travis/forthedamn/safe-window-location.svg)](https://travis-ci.org/forthedamn/safe-window-location)\n[![code coverage](https://img.shields.io/codecov/c/github/forthedamn/safe-window-location.svg)](https://codecov.io/gh/forthedamn/safe-window-location)\n[![license](https://img.shields.io/github/license/forthedamn/safe-window-location.svg)](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/safe-window-location.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/safe-window-location\n\n\u003e redirect parent(top) window location safely\n\n\n## Install\n\n\n\n```sh\nnpm install safe-window-location\n\nyarn add safe-window-location\n```\n\n\n## Usage\n\n\n```\n// ./config/default.js\n\nmodule.exports = {\n  urlWhiteList: [\n    /**\n     * allow the hostname end with 'github.com'\n     * like 'https://github.com/**'\n     */\n    /github\\.com$/\n  ]\n}\n```\n\n\n```js\nconst SafeWindowLocation = require('safe-window-location');\n\nconst app = new Koa();\napp.use((ctx, next) =\u003e {\n  // set parent window as new location\n  return SafeWindowLocation(ctx, 'new location', 'parent', 'urlWhiteList');\n})\n```\n\nparam | usage | required | default\n--- | --- | ---| ---\nctx | koa context | yes | \nlocation | window location, like https://www.npmjs.com | - | /\ntarget | window target, like window.parent | - | parent\nconfig name | config option name | - | whiteList\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforthedamn%2Fsafe-window-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforthedamn%2Fsafe-window-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforthedamn%2Fsafe-window-location/lists"}