Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6350849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:53:22+00:00 2026-05-24T21:53:22+00:00

we need a kind of client-side redirection and the only options we have are:

  • 0

we need a kind of client-side redirection and the only options we have are:

  1. window.location
  2. window.open
  3. HTTP 301, 302, 303 responses

window.location doesn’t support opening the target location in a new tab or window. (I think this is related to browsing context)

window.open doesn’t work in Chrome and seems to be dependent upon some client-side configurations made to the browser, which makes it a less favorable option, since we don’t have control on it.

HTTP redirect response doesn’t open a new tab or window, just like window.location.

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:53:22+00:00Added an answer on May 24, 2026 at 9:53 pm

    After playing around with this for hours last night, I had a flash of inspiration this morning, and I have just tested this solution in FF3, Chrome, IE7 and IE8 – it’s a bit hacky but it works in all.

    <html>
    
      <head>
        <title>Redirect in a new window</title>
        <script type="text/javascript">
          function doIt () {
            var form = document.createElement('form');
            form.action = 'http://www.google.com/';
            form.target = '_blank';
            document.getElementById('hidden_div').appendChild(form);
            form.submit();
          }
        </script>
        <style>
          #hidden_div {
            display: none;
          }
        </style>
      </head>
    
      <body>
        <div>
          This is my page content<br />
          <a href="http://www.google.com/">This is a link to Google</a>...<br />
          ...and this button will open Google in a new tab or window: <input type="button" value="Click Me!" onclick="doIt();" />
        </div>
        <div id="hidden_div"></div>
      </body>
    
    </html>
    

    How It Works

    You need a hidden <div> on your page somewhere that you can get a reference to in JS (no big deal – just create one with display: none).

    When you want to do the redirect, use document.createElement() to create a new <form> element, assign it’s action attribute with the address of the page where you want to take the user, and give it a target attribute as appropriate (I have used _blank in my example above). Then simply append it to your hidden <div> and call it’s submit() method.

    Hey presto, your redirect opens in a new window/tab!

    Unfortunately you are still at the mercy of how the user configures their browser to handle target="_blank" but it will be either a new window or a new tab, and it should work everywhere…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a written a client side HTTP cache and I need to store
I have a web application. On the client side I basically need to get
I have a need for some kind of information that is in essence static.
Recently, I came across this kind of need. The client(web browser) requests for a
I'm kind of new in the websocket, I learned the client-side code (in JavaScript)
I need to be able to send an email from a silverlight client-side application.
In my project I have a lot of Ajax methods, with external client-side scripts
The users of my web application may have more than one browser window open
I need some kind of dialog for browsing the local SMB network for file
I need some kind of priority queue to store pairs <key, value> . Values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.