javascript jQuery - 在页面加载时打开新窗口

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

jQuery - open new window on page load

javascriptjquery

提问by user547794

How do I open a new browser window on page load w/ jQuery?

如何使用 jQuery 在页面加载时打开一个新的浏览器窗口?

Thanks!

谢谢!

回答by hunter

You can do this in the jQuery document.readyevent (shortcut'ed below) by calling the window.open()method

您可以document.ready通过调用window.open()方法在 jQuery事件(下面的快捷方式)中执行此操作

$(function(){ 
    window.open(url, windowName[, windowFeatures]); 
});

windowFeatures:

窗户特点:

  • statusThe status bar at the bottom of the window.
  • toolbarThe standard browser toolbar, with buttons such as Back and Forward.
  • locationThe Location entry field where you enter the URL.
  • menubarThe menu bar of the window
  • directoriesThe standard browser directory buttons, such as What's New and What's Cool
  • resizableAllow/Disallow the user to resize the window.
  • scrollbarsEnable the scrollbars if the document is bigger than the window
  • heightSpecifies the height of the window in pixels. (example: height='350′)
  • widthSpecifies the width of the window in pixels.
  • status窗口底部的状态栏。
  • 工具栏标准浏览器工具栏,带有后退和前进等按钮。
  • 位置您在其中输入 URL 的位置输入字段。
  • menubar窗口的菜单栏
  • 目录标准浏览器目录按钮,例如 What's New 和 What's Cool
  • resizable允许/禁止用户调整窗口大小。
  • scrollbars如果文档大于窗口,则启用滚动条
  • height以像素为单位指定窗口的高度。(例如:高度='350')
  • width以像素为单位指定窗口的宽度。

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml