Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

New Page

What is the HTML tags or procedure to have your browser open a new Window when a
page is loaded or a link is clicked?
Where do I place this tag?
0
Protorian1
Asked:
Protorian1
  • 2
1 Solution
 
vendrigCommented:
The JavaScript procedure is
window.open("page.html", "MyNewWindow")
To open a window when a page is loaded, simply put it in the body tag:
<BODY onLoad='window.open("page.html", "MyNewWindow")'>
To open a window when a link is clicked, put it in the relevant anchor:
<a href="page1.html" onClick='window.open("page2.html", "MyNewWindow")'>blabla</a>
Note the use of single and double quotes.
0
 
sybeCommented:
It can be done using only HTML, no javascript needed:

<a href="newpage.htm" target="newwindow">open this in a new window</a>

It will open a new window when the name "newwindow" is not yet in use for a frame or window.

0
 
vendrigCommented:
Yep, sybe.
Note that the JavaScript procedures have other effects though.
Use the scripts if you need to load more than one page at the time,
otherwise the target attribute is sufficient.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now