HTML
  Home arrow HTML arrow Page 3 - Uses of the New Window Command for Web Sit...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Uses of the New Window Command for Web Sites
By: Stephen Davies
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2008-02-26

    Table of Contents:
  • Uses of the New Window Command for Web Sites
  • Approaches to opening a link in a new window
  • BASE tag
  • Examples of common new window uses
  • Advanced Usage

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Uses of the New Window Command for Web Sites - BASE tag


    (Page 3 of 5 )


    3. Use the HTML <BASE> tag

    The <BASE ...> tag tells the browser to pretend that the current page is located at some URL other than where the browser found it. Any relative reference will be calculated from the URL through <BASE HREF="..."> instead of the actual URL. <BASE ...> goes in the <HEAD> section. The <BASE> tag has three attributes: id, href, and target.

    e.g.

    <base target="_blank" />


    With the above code added inside the HTML <head>..</head>, all links in the web page will be opened in a new window, unless that link's target attribute is specified.

    Caution:

    The target attribute of the BASE tag is removed in the XHTML strict mode, so we can only use it in the transitional or framesets mode of XHTML. It will probably work fine in traditional HTML pages.

    4. The last and the best approach is the JavaScript window.open() method.

    JavaScript is an object-based programming language; it can be embedded in the HTML code and will be executed by the browser. The method that is used to open a new window is window.open(...), which is a JavaScript built-in method within the top level JavaScript object window.

    Usage:


    window.open(url, winName, features)


    e.g.


    <script type="text/javascript">

    window.open('http://www.yahoo.com', 'popWin', 'width=500, height=500,
    menubar=no, toolbar=no, resizable=no');

    </script>


    Parameters explanation:

    url - the destination / target url that will be opened in the window.

    winName - specifies the window name; it can be empty or you can use the four special window names "_blank" / "_self" / "_top" / "_parent" if you want to open the window in a particular place.

    Features - customizes the new window's feature.


    Valid feature options:

    Options

    Description

    width

    specifies the width of the window

    height

    specifies the height of the window

    menubar

    denotes whether there will be a menu bar. (The menu bar is the line of items above labeled FILE, EDIT, VIEW, GO, etc.)

    toolbar

    denotes whether there will be a toolbar on the newly opened window. (The toolbar is the line of buttons at the top of the browser window that contains BACK, FORWARD, STOP, RELOAD, etc.)

    location

    denotes whether there will be a location bar on the newly opened window. (The location bar is the space at the top of the browser window where the page URL is displayed.)

    scrollbars

    denotes whether there will be scrollbars or not. I wouldn't make a new window that would need scrollbars anyway. I think it kills the effect.

    status

    denotes whether there will be a status bar

    resizable

    denotes whether the user can change the size of the window by dragging.

    More HTML Articles
    More By Stephen Davies


       · open new windows is in most cases - from the user's point of view - a bad idea:*...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT