在 HTML 中打开弹出窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11812161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:06:02  来源:igfitidea点击:

Opening popup windows in HTML

html

提问by Arlen Beiler

I am working with web apps, and I am wondering if there is a way to open a link in an app-type window using HTML? Something like this:

我正在使用网络应用程序,我想知道是否可以使用 HTML 在应用程序类型窗口中打开链接?像这样的东西:

<a href="link" target="_app">My App</a>

回答by amitchhajer

Something like this?

像这样的东西?

<a href="#" onClick="MyWindow=window.open('http://www.google.com','MyWindow','width=600,height=300'); return false;">Click Here</a>

回答by Pradeep Kumar Prabaharan

HTMLalone does not support this. You need to use some JS.

HTML单独不支持这一点。您需要使用一些JS.

And also consider nowadays people use popup blocker in browsers.

还要考虑现在人们在浏览器中使用弹出窗口拦截器。

<a href="javascript:window.open('document.aspx','mypopuptitle','width=600,height=400')">open popup</a>

回答by Fuller93

I feel like this is the simplest way. (Feel free to change the width and height values).

我觉得这是最简单的方法。(随意更改宽度和高度值)。

<a href="http://www.google.com" 
target="popup" 
onclick="window.open('http://www.google.com','popup','width=600,height=600'); return false;">
Link Text goes here...
</a>