<a href="https://codepen.io/leo-loki" target="_blank">(通常)別タブで開く</a>
<p>&nbsp;</p>
<a href="https://codepen.io/leo-loki" onclick="newwinOpen(this.href, 'myWin', option); return false;">別窓(ウィンドウ)で開く</a>
<p>親ウインドウの高さ、幅は1/2の各インナーサイズで別窓を生成。</p>
var newwin;
var url;
var winName;
var winWidth;
var winHeight;
winWidth = window.innerWidth / 2;
winHeight = window.innerHeight;
if(winWidth<320){ winWidth = 320; }
if(winHeight<320){ winHeight = 320; }
var addOpt = 'menubar=no, toolbar=no, scrollbars=yes';
var option = 'width=' + winWidth + ', height=' + winHeight + ', ' + addOpt;

window.addEventListener( 'resize', function(){
 winWidth = window.innerWidth / 2;
 winHeight = window.innerHeight;
 if(winWidth<320){ winWidth = 320; }
 if(winHeight<320){ winHeight = 320; }
 option = 'width=' + winWidth + ', height=' + winHeight + ', ' + addOpt;
}, false );

function newwinOpen(url, winName, option) {
  newwin = window.open(url, winName, option);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.