www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to open a link in a new window as before?

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    How to open a link in a new window as before?

    I have link as <a href="url">Link text</a>. I am trying to open this link in a new window but not only that. When I go back to my page and click on the link again so I want to jump to the same page (if it's still open) and refresh it.

    So the first time I click on the link ... a new window
    the second time I click on the link ... if the previous window is still open ... jump there and refresh.

    Do you have any idea how to address the same window if it is open?
    Thanks for any humm...

  2. #2
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    This is exactly what the target attribute is for!

    By specifying a unique 'framename' (not to be confused with HTML frames/framesets) you can open/reopen a link (or a set of links) in a specific window/tab

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,217
    The target="" attribute always is misused because browsers are still reacting to it incorrectly. Sites do not control how links are opened on a web page. The links are set by the users' browsers' settings for Tabs. Or, they can right click any link and select to open in a new window or tab from the popup Context Menu.

    Avoid forcing to open in a new window: http://www.webnauts.net/new-window.html
    Force links to open in new window: http://www.knowlegezone.com/pages/document.aspx?item=9

    If you want a correct way, which is not aways reliable depending on JS being enabled in the browser, use:

    Open new window:

    Code:
    onclick="window.open (this.href, ''); return false"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles