Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - open new window on page load

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

Thanks!

like image 606
user547794 Avatar asked Dec 01 '25 15:12

user547794


1 Answers

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

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

windowFeatures:

  • status The status bar at the bottom of the window.
  • toolbar The standard browser toolbar, with buttons such as Back and Forward.
  • location The Location entry field where you enter the URL.
  • menubar The menu bar of the window
  • directories The standard browser directory buttons, such as What’s New and What’s Cool
  • resizable Allow/Disallow the user to resize the window.
  • scrollbars Enable the scrollbars if the document is bigger than the window
  • height Specifies the height of the window in pixels. (example: height=’350′)
  • width Specifies the width of the window in pixels.

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

like image 150
hunter Avatar answered Dec 03 '25 05:12

hunter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!