[JavaScript] ํ์ ์ฐฝ ๊ตฌํ - window.open
ํ๋ก์ ํธ์์ ๊ธฐํ ๋ช ์ธ๋ฅผ ๋ฐํ์ผ๋ก ๋ ๋ฆฝ๋ ํ์ ์ฐฝ์ ๊ตฌํํด์ผ ํ๋ค.
JavaScript์ window.open ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ํ์ ์ฐฝ์ ๊ตฌํํ์๋ค.
window.open ๋ฉ์๋
์ ๋ธ๋ผ์ฐ์ ์ฐฝ์ด๋ ํญ์ ์ด ๋ ์ฌ์ฉํ๋ ๋ฉ์๋
window.open(url, windowName, [windowFeatures]);
- url : ํ์ ์ฐฝ์ ๋ก๋ํ ํ์ด์ง URL
- windowName : ํ์ ์ฐฝ์ ์ด๋ฆ. ๊ฐ์ ์ด๋ฆ์ ๊ฐ์ง ์ฐฝ์ด ์ด๋ฏธ ์ด๋ ค์๋ค๋ฉด ํด๋น ์ฐฝ์ ์ฌ์ฌ์ฉ.
- windowFeatures : ํ์ ์ฐฝ์ ํน์ฑ์ ์ ์ํ๋ ๋ฌธ์์ด.
์ฝ๋ ์์
<button onClick="openPopup()">์ฝ๊ด ๋ณด๊ธฐ</button>
<script>
function openPopup() {
window.open(
'/signup/terms',
'popup',
'toolbar=no,scrollbars=no,resizable=yes,status=no,menubar=no,width=600,height=700,top=0,left=0'
);
}
</script>
Reference
Window: open() method - Web APIs | MDN
The open() method of the Window interface loads a specified resource into a new or existing browsing context (that is, a tab, a window, or an iframe) under a specified name.
developer.mozilla.org
Window - Web APIs | MDN
The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window.
developer.mozilla.org
'Language > JavaScript' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JavaScript] ๋ง์ฐ์ค ๋ฐ ํ ์ด๋ฒคํธ (onMouseEnter, onMouseLeave, onWheel) (0) | 2024.05.20 |
---|---|
[JavaScript] javascript ์์๋ ๊ฒ (0) | 2023.01.31 |
[JavaScript] LocalStorage์ SessionStorage (0) | 2023.01.29 |
[JavaScript] async / await 2 (0) | 2023.01.26 |
[JavaScript] async / await 1 (1) | 2023.01.25 |
๋๊ธ