[英]Onclick open new window javascript
I am trying to open new window using Javascript. 我正在尝试使用Javascript打开新窗口。 My code is given below. 我的代码如下。
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>
New window is opening using this code, but it is not same as like that of new tab, the menus are missing. 使用此代码将打开新窗口,但与新选项卡不同,菜单丢失。 I need to show the bookmarks also. 我还需要显示书签。
That may not be possible Read this : https://bugs.chromium.org/p/chromium/issues/detail?id=82522 可能无法阅读: https : //bugs.chromium.org/p/chromium/issues/detail?id=82522
Try this : 尝试这个 :
<!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>
Copy this code , in code snippet/stackoverflow open popup is not allowed. 复制此代码,不允许在代码段/堆栈溢出中打开弹出窗口。
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.