[英]How to show fullscreen popup window in javascript?
Is there a way to make a popup window maximised as soon as it is opened?有没有办法让弹出窗口一打开就最大化? If not that, at least make it screen-sized?如果不是这样,至少让它成为屏幕大小? This:这:
window.open(src, 'newWin', 'fullscreen="yes"')
apparently only worked for old version of IE.显然只适用于旧版本的 IE。
Use screen.availWidth
and screen.availHeight
to calculate a suitable size for the height and width parameters in window.open()
使用screen.availWidth
和screen.availHeight
为window.open()
的 height 和 width 参数计算合适的大小
Although this is likely to be close, it will not be maximised, nor accurate for everyone, especially if all the toolbars are shown.尽管这可能很接近,但它不会最大化,也不会对每个人都准确,尤其是在显示所有工具栏的情况下。
What about this:这个怎么样:
var popup = window.open(URL);
if (popup == null)
alert('Please change your popup settings');
else {
popup.moveTo(0, 0);
popup.resizeTo(screen.width, screen.height);
}
More than bad design - this "feature" is a recipe for UI disaster.不仅仅是糟糕的设计——这个“功能”是 UI 灾难的一个秘诀。 There were a number of malicious web sites which exploited the full screen view features in JavaScript to hijack browser windows and display a screen indistinguishable from the user's desktop.有是一个数量的 恶意它利用JavaScript中的全屏幕视图功能,以劫持浏览器窗口,并显示在用户的桌面上难以区分屏幕的网站。 While there may still be a way to do this, please for the love of all things decent, do not implement this.虽然可能仍然有一种方法可以做到这一点,但请不要执行此操作。
这个怎么样,我给了一个很大的宽度和高度值并且它有效
window.open("https://www.w3schools.com", "_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=4000,height=4000");
Try this.试试这个。 This works for me and with any link you want, or anything in the popup这对我有用,并且可以使用您想要的任何链接,或弹出窗口中的任何内容
Anything you chose will be shown in a PopUp window in a full screen size within a PopUp Window.您选择的任何内容都将在弹出窗口内以全屏尺寸显示在弹出窗口中。
<script language="JavaScript">
function Full_W_P(url) {
params = 'width='+screen.width;
params += ', height='+screen.height;
params += ', top=0, left=0'
params += ', fullscreen=yes';
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', toolbar=no';
newwin=window.open(url,'FullWindowAll', params);
if (window.focus) {newwin.focus()}
return false;
}
</script>
<input type="button" value="Open as Full Window PopUp" onclick="javascript:Full_W_P('http://www.YourLink.com');"></input>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.