SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Open New Window Problem

    I have this problem.

    I have a javascript in my index.html to open a new window(newpage.html). This is ok.

    The problem is from the opened window (newpage.html), if i click on a link back to the index.html, the index.html will auto refresh to newpage.html without open a new window to newpage.html

    Any link back to index.html from the opened newpage.html window will cause the script to load a new page within that window.

    Links to other pages from the new window are working fine.

    i suspect it's due to the Window name "new" which i have set to the opened window so each time, from that window, if i go back to index.html, the javascript will detect the window name and open the new page in the same window.

    Any solution to stop this? Can i open a new window without calling a name in the javascript?

    <!--// Hide this script from old browsers --
    new = open("http://domainname.com/newpage.html", "new","toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,scrolling=1");window.focus();
    // -- End Hiding Here
    // -->

  2. #2
    SitePoint Enthusiast alnixon's Avatar
    Join Date
    May 2001
    Location
    Preston (UK)
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    taken from the javascript documentation:

    Special target values are:


    _blank opens the destination document in a new unnamed window.
    _parent opens the destination document in the parent window of the one displaying the current document.
    _self opens the destination document in the same window as the one in which the link was clicked.
    _top opens the destination document in the full body of the current window. This value can be used to ensure that the destination document takes over the full window even if the original document was displayed in a frame.
    Da Big Cheese
    --------------
    I'm not entirely sure on this, but ....
    [insert my post here]

  3. #3
    SitePoint Member
    Join Date
    Feb 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alnixon,

    Problem solved when i replaced "new" with "_blank"

    <!--// Hide this script from old browsers --
    _blank = open("http://domainname.com/newpage.html", "_blank","toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,scrolling=1");window.focus();
    // -- End Hiding Here
    // -->


Bookmarks

Posting Permissions

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