Click the button to open the new user-defined sized window Įxecute the code and get the output as given below. It is 300px wide and 150px tall new window! ") Var newtab = window.open("", "anotherWindow", "width=300,height=150") By clicking on this button, window.open() method will call and open the website in new browser tab. This is a simple example of window open method having a website URL inside it. By default, the specified URL opens in new tab or window. Here are some examples of window.open() function to open the browser window/tab. Return false if URL creates a new entry in history list. Return true if URL replaces the current entry or document in history list. It supports two Boolean values this means that it returns either true or false: True It either creates a new entry or replaces the current entry in history list. Replace: Like the other parameters of window.open() method, this is also an optional parameter. Element used in this parameter cannot have whitespaces, e.g., width=150,height=100. Specs: This parameter contains the settings that are separated by the comma. The above-specified values are passed inside a single or double quote to the window.open() function at the name parameter place. Provide the name of the new window to show the text or any data on it. URL replaces any frameset that can be loaded. URL will load into the parent window or frame that is already opened.īy passing this parameter, the URL will replace the previous output and a new window will open in the same frame. Passed URL will load into a new tab/window. Name: Using this parameter, you can set the name of the window you are going to open. If you do not specify any URL in this function, it will open a new blank window ( about:blank). URL: This optional parameter of the window.open() function contains the URL string of a webpage, which you want to open. Note that - all parameters of this method are optional and works differently. Parameters Listīelow is the parameters list of window.open() method. There is no difference between both syntaxes.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |