www.webdeveloper.com
Results 1 to 13 of 13

Thread: open a new window, then close the old one

  1. #1
    Join Date
    Jan 2010
    Posts
    7

    open a new window, then close the old one

    how can i accomplish this

  2. #2
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    That's the default behavior of any normal HTML link.
    Code:
    <a href="http://www.cnn.com">CNN</a>
    Perhaps I'm misunderstanding your request?

  3. #3
    Join Date
    Jan 2010
    Posts
    7
    i do understand that, but

    my question is, the following

    i want to click on a link that will open a new window (parent), and from the new window close the child window

  4. #4
    Join Date
    Jan 2010
    Posts
    14
    If you want a link to open in a new window (which wouldn't be parent by the way) Then the code you need is:
    Code:
    <a href="newwindow.html" target="_blank">a new window</a>
    But from what i understand from your post you want to open a new window and close the old one? Well that doesn't make sense because if you open a link in the normal way:
    Code:
    <a href="yourlink.html">Your Link</a>
    then ot will open up in the place of the window you are in, hence "closing" the page you were on, there is no function to open a link in a new window an then close the old one because i can't imagine a situation where this would be needed.


    Hope that helps you.
    Last edited by Str8TalkingBob; 01-07-2010 at 10:52 AM. Reason: spelling mistake

  5. #5
    Join Date
    Jan 2010
    Posts
    7
    ok, let me explain better

    window 1 has a link
    after the link is clicked window 2 opens (_blank)

    i want to close window 1 without clicking x or anything like that, but though a script.

  6. #6
    Join Date
    Jan 2010
    Posts
    14
    If you want window 1 to be closed then why are you opening window 2 in a new window? it makes no sense, if you want window 1 to be closed then just open up widow 2 in its place.

  7. #7
    Join Date
    Jan 2010
    Posts
    7
    i want to clear the cookie, and the only way that works is closing the browser, i tried several script to clear cookies and none of them work, so i am trying a different approach

  8. #8
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    I'm not sure that would work, given that both Fx and IE allow "new windows" to be open in "new tabs," meaning that the browser wouldn't close. Also, deletion of cookies upon close is a browser setting; the default browser behavior is to retain cookies. Only if the visitor has customized their browser preferences to eliminate cookies upon close would it work.

    What I'd do is use JS to put an expiration on the cookie.
    Here's a start -
    Reference: http://techpatterns.com/downloads/ja...pt_cookies.php

    Note - this still isn't foolproof.

  9. #9
    Join Date
    Jan 2010
    Posts
    7
    this is one of the things i try, and i get the following error.

    is not working, i get the following error

    Cookies object error 'ASP 0162 : 80004005'

    Cannot Modify Cookie

    /forms/default.asp, line 9

    The cookie 'ASPSessionID' cannot be modified. It is a reserved cookie name.

  10. #10
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    That sounds like a database problem, rather than your script.

  11. #11
    Join Date
    Jan 2010
    Posts
    7
    database problem? that is the name of the cookie that gets stored on my browser, i cant modify it, that's what i understood.

  12. #12
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    But you're using ASP to connect to something, right? Or is that just the file extension you're using?

    If that's not the case, I'd see if there is something running a loop with that cookie that's preventing its deletion.

  13. #13
    Join Date
    Jan 2010
    Posts
    7
    yes
    ldap

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