我正在尝试使用Javascript打开新窗口。我的代码如下。
function openMeeting()
{
var popup = window.open("myurl", "_blank", "menubar= yes,scrollbars=yes,resizable=yes,top=500,left=500,width="+screen.availWidth+",height="+screen.availHeight);
if (popup == null)
alert('Please change your popup settings', popup);
}
<li class="nav-item"> <a href="#" class="nav-link" onclick="openMeeting();"> Join meeting </a> </li>
正在使用此代码打开新窗口,但与新标签页不同,菜单丢失。我还需要显示书签。
答案 0 :(得分:0)
那不可能 阅读:https://bugs.chromium.org/p/chromium/issues/detail?id=82522
尝试一下:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<a class="link">Link</a>
<script type="text/javascript">
$("a.link").on("click",function(){
window.open('http://google.com','_blank');
});
</script>
</body>
</html>
答案 1 :(得分:0)
复制此代码,不允许在代码段/堆栈溢出中打开弹出窗口。
function openMeeting()
{
var popup = window.open("https://stackoverflow.com", "popUpWindow", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
if (popup == null) alert('Please change your popup settings');
}
/*
menubar= yes,scrollbars=yes,resizable=yes,top=500,left=500,width="+screen.availWidth+",height="+screen.availHeight
window.open('https://www.quackit.com/javascript/examples/sample_popup.cfm','popUpWindow','height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
*/
<li class="nav-item"> <a href="#" class="nav-link" onclick="openMeeting();"> Join meeting </a> </li>