Home arrow HTML arrow Page 2 - Uses of the New Window Command for Web Sites
HTML

Uses of the New Window Command for Web Sites


This article talks about opening new windows on a web page. There are a number of reasons why we might want to do this. So let's think about why we need to open a link in a new window.

Author Info:
By: Stephen Davies
Rating: 4 stars4 stars4 stars4 stars4 stars / 2
February 26, 2008
TABLE OF CONTENTS:
  1. · Uses of the New Window Command for Web Sites
  2. · Approaches to opening a link in a new window
  3. · BASE tag
  4. · Examples of common new window uses
  5. · Advanced Usage

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Uses of the New Window Command for Web Sites - Approaches to opening a link in a new window
(Page 2 of 5 )

Before I show the approaches, I'd like to review some basic HTML knowledge about the window name, because every window in the browser has its own name. The default name is an empty string "", so we can say the window has no name. There are four special window names: "_blank", "_self", "_parent" and "_top". By using "_blank" you indicate that the link will be opened in a new blank window, while "_self" indicates that the window will open in the same window. The third option, "_parent," means the link will be opened in the parent frame. This name is usually used in frameset pages. The last one, "_top," indicates the top level window, which is used in some pages with the <iframe> tag to include other pages inside the <iframe> content, where links can open in the top level window.

1. Set target attribute of the link

e.g.

<a href="http://www.google.com" target="_blank">Go to Google.com</a>


When visitors click the link above, a new window will open and display the content of the Google search engine page.

Caution:

The target attribute is deprecated in the latest strict version of HTML (XHTML), so it is not recommended that you use it this way. If your web sites use this approach, the pages will not pass XHTML validation (http://validator.w3.org/), which means the web page is not a standards-strict XHTML page. Luckily this attribute can still be used in the XHTML transitional and framesets mode.

2. Right mouse contextual menu

I think this approach is the most commonly used one when you want to have a link opened in a new window. The original design of the web page does not behave that way, but we can move our mouse over the link and right click the mouse in order to pop up the contextual menu. There is an item called ''Open Link in New Window." The following pictures show this when we right click the mouse on Google's home page.

 


Picture 2 - Right mouse contextual menu in Firefox

 


Picture 3 - Right mouse contextual menu in Internet Explorer



blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials