일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Kubernetes
- 배포 파이프라인
- GoF
- goland
- golang
- esbuild
- 배포 프로세스
- intellij ide
- apollo router
- 코사인 유사성 메트릭스
- AWS
- body size
- go
- Intellij
- kube-prometheus-stack
- 디자인패턴
- typescript
- javascript
- cosine similarity metric
- http 413
- 티스토리챌린지
- 오블완
- 구조체
- Infra
- 사설 ip
- m4 pro
- gitops
- elasticsearch
- UnBuffered channel
- 캡슐화
Archives
- Today
- Total
Fall in IT.
window.opener 알아보기 본문
반응형
안녕하세요.
오늘은 window.opener에 대해서 알아보도록 하겠습니다.
샘플 코드는 여기에서 확인해주시기 바랍니다.
window.opener이란?
- 윈도우 A에서 window.open()을 통해 윈도우 B를 열었다면, window.opner를 통해 윈도우 B에서 윈도우 A를 제어할 수 있다.
Sample Code
// index.js (윈도우 A) window.onload = () => { setEventHandler(); main(); } function setEventHandler() { // 윈도우 B 열기 버튼 document.getElementById("window-open-button").onclick = () => { window.open("window-b.html", "_blank", 'width=425, height=550, resizable=0, scrollbars=no, status=0, titlebar=0, toolbar=0, left=435, top=250'); } } function main() { console.log("called main"); } function eventListener() { alert('called event listener'); }
// window-b.js (윈도우 B) window.onload = () => { main(); } function main() { console.log("called main"); window.opener.window.eventListener(); }
참조
- https://github.com/leeduyoung/window-opener-sample
- https://developer.mozilla.org/ko/docs/Web/API/Window/opener
모두 즐거운 코딩하세요~
반응형
'프로그래밍언어 > Javascript & Typescript' 카테고리의 다른 글
Typescript 싱글톤 패턴 (0) | 2019.04.07 |
---|---|
javascript 숫자와 숫자 사이의 랜덤 숫자 뽑는방법 (0) | 2018.12.13 |
Javascript every 메소드 사용하기 (1) | 2018.11.21 |
Typescript Partial, Required, Pick 사용방법 (1) | 2018.09.17 |
Typescript Generic이란? (1) | 2018.08.30 |
Comments