dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Close redirect page after redirect

  1. #1
    Join Date
    Dec 2012
    Posts
    4

    Close redirect page after redirect

    Hello,

    I'm redirecting to a page that I need to open in a new window. I need the redirect page to close when the window opens. I've tried window.location and window.open, but the redirect page stays open in the background. How do I get it to close automatically after it redirects. Thanks.


    I cannot use a regular HTML target=new or target=window for this. Have to use Javascript for this.

    John

  2. #2
    Join Date
    Dec 2012
    Posts
    54
    window.close()

    as long as you opened that window with your script as well otherwise you will get this error:

    [16:13:09.666] Scripts may not close windows that were not opened by script. @ <sitename>

  3. #3
    Join Date
    Dec 2012
    Posts
    4
    Thanks but how do I suppress or disable the alert box that pops up? - "The webpage you are viewing is trying to close the tab, etc ..." I do not want users to see the alert box.

  4. #4
    Join Date
    Dec 2012
    Posts
    54
    I'm having a problem simulating your issue can you post a code snippet that demonstrates your error?

  5. #5
    Join Date
    Dec 2012
    Posts
    4
    <script type="text/javascript">

    window.open ("http://www.google.com");
    window.close()


    </script>

  6. #6
    Join Date
    Dec 2012
    Posts
    4
    Any way to suppress or disable the alert box? This is driving me crazy.

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