{"id":18936981,"url":"https://github.com/mattbryson/window-opener","last_synced_at":"2025-08-09T05:08:17.739Z","repository":{"id":58228645,"uuid":"149280523","full_name":"mattbryson/window-opener","owner":"mattbryson","description":"A small utility that fixes window.open so the resulting window is the size you actually requested","archived":false,"fork":false,"pushed_at":"2018-09-18T14:13:55.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T07:40:50.160Z","etag":null,"topics":["browser","javascript","javascript-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattbryson.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":"2018-09-18T11:54:53.000Z","updated_at":"2018-09-18T14:13:57.000Z","dependencies_parsed_at":"2022-08-31T09:20:41.066Z","dependency_job_id":null,"html_url":"https://github.com/mattbryson/window-opener","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mattbryson/window-opener","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbryson%2Fwindow-opener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbryson%2Fwindow-opener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbryson%2Fwindow-opener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbryson%2Fwindow-opener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattbryson","download_url":"https://codeload.github.com/mattbryson/window-opener/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbryson%2Fwindow-opener/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261543873,"owners_count":23174825,"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":["browser","javascript","javascript-plugin"],"created_at":"2024-11-08T12:09:29.234Z","updated_at":"2025-06-23T19:35:41.766Z","avatar_url":"https://github.com/mattbryson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Window Opener\n\n\nA small javaScript utility to make sure that `window.open` actually opens **same domain** windows at the size you requested.\n\n### Why\n\nOpening a window with a set viewport is notoriously difficult across all the different browsers, and they usually end up 20px or so too short.\n\n### How\n\nIt opens a new window as per usual, but then checks the `innerHeight` and `innerWidth` match the initial request, and adjusts the window size accordingly.\n\n### Wont\n\nUnfortunately it will not run cross domain due to same origin security policies.\n\n## Installation  \n### NPM\n````bash\nnpm install window-opener --save\n````\n### YARN\n````bash\nyarn add window-opener\n````\n### Bower\n````bash\nbower install window-opener --save\n````\n### Manual\nInclude the file in your project.\n````html\n\u003cscript type=\"text/javascript\" src=\"window-opener.js\"\u003e\u003c/script\u003e\n````\n\n## Usage\n\n### Browser\n````html\n\u003cscript type=\"text/javascript\" src=\"window-opener.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    windowOpener.open('http://www.domain.com', '_blank', 'width=500px, height=500px');\n\u003c/script\u003e\n\n````\n\n### Require\n````javascript\ndefine(['path/to/window-opener'], function (windowOpener) {\n    windowOpener.open('http://www.domain.com', '_blank', 'width=500px, height=500px');\n});\n\n````\n\n## Demo\n[A super simple demo](https://mattbryson.github.io/window-opener/demo/index.html)\n\n## API\n\n### open( url, windowName, [windowFeatures] )\nThis is exactly the same as `window.open`\n\n### wrap()\nWraps the native `window.open` method with `windowOpener.open`, meaning you don't have to update any of your code.\n\n````javascript\nwindowOpener.wrap();\n\n...\n\n// all window.open calls now run via windowOpener.open\nwindow.open('http://www.domain.com', '_blank', 'width=500px, height=500px');\n\n\n````\n\n### unWrap()\nRestores the native `window.open` method\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbryson%2Fwindow-opener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattbryson%2Fwindow-opener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbryson%2Fwindow-opener/lists"}