window.focus() not working in Safari
I am trying to test a simple JS code snippet with window.focus()
Its working fine in Chrome, but not working in Safari
Can someone help me to figure out the issue
<!DOCTYPE html>
<head>
<title>Test window.focus() in Safari</title>
</head>
<body>
<button onclick="openWindow()">Test button</button>
</body>
<script>
function openWindow(){
var win = window.open();
win.document.write("Howdy");
win.focus();
}
</script>
</html>