javascript window.open URL 参数中的可用参数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7088353/
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-10-25 22:55:50  来源:igfitidea点击:

Available parameters in window.open URL argument

javascriptwindow.open

提问by xorpower

In window.open javascript command (which opens a new windows) what options are available for first argument i.e URL?

在 window.open javascript 命令(打开一个新窗口)中,第一个参数(即 URL)有哪些可用选项?

One which is very common is http format (e.g. http://www.google.com). Which are the others?

一种非常常见的格式是 http 格式(例如http://www.google.com)。还有哪些?

Can i open a .pdf file from a shared folder using window.open?

我可以使用 window.open 从共享文件夹中打开 .pdf 文件吗?

Thanks!

谢谢!

回答by Robert

var myWindow = window.open(url, windowName[, windowFeatures]);

You can read more about it here: http://developer.mozilla.org/en/DOM/window.open

您可以在此处阅读更多相关信息:http: //developer.mozilla.org/en/DOM/window.open

回答by sdleihssirhc

According the MDN Docs:

根据MDN 文档

This is the URL to be loaded in the newly opened window. strUrl can be an HTML document on the web, it can be an image file or any type of file which is supported by the browser.

这是要在新打开的窗口中加载的 URL。strUrl 可以是网页上的 HTML 文档,也可以是图像文件或浏览器支持的任何类型的文件。

I assume this will work in most/all browsers, but the MSDN articledoesn't get too specific, so you might have to experiment.

我认为这适用于大多数/所有浏览器,但MSDN 文章并没有太具体,因此您可能需要进行试验。