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 7818673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:39:27+00:00 2026-06-02T06:39:27+00:00

I have a funny complication i would like to understand, if i have window.open

  • 0

I have a funny complication i would like to understand, if i have window.open as the onclick event of an anchor, a new tab is opened as required. If the onclick calls a function, which in turn does a window.open a new tab is opened, but also the current tab gets the new url as well.

I can demonstrate it here it works ok when you click on the link, wheras here the url is also opened in the results area as well !

Thanks
Symeon.

  • 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-06-02T06:39:30+00:00Added an answer on June 2, 2026 at 6:39 am

    Your first case statement is falling through. You need to add a break:

    switch (t) {
        case 1: 
            window.open(url,"_blank");
            break;
        case 2: 
            window.location = url;
            break;
    }
    

    Without the break, every case below the one that was first matched will be executed.

    I have added a break to the second case too, simply because it’s generally considered good practice to always break a case. In fact, JSLint will flag a missing break as an error.

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

Sidebar

Related Questions

I have a funny event with one application in development using OpenGL ES on
I have a somehow funny issue. While trying to understand why a certain website
I have an array of file-path strings like this videos/funny/jelloman.wmv videos/funny/bellydance.flv videos/abc.mp4 videos/june.mp4 videos/cleaver.mp4
I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php
I have a funny little situation on my hands. I have a httpModule on
I have a image here http://power.itp.ac.cn/~jmyang/funny/fun4.jpg and I want to display it in my
I am implementing the superfish menu and have noticed that there is a funny
I have a funny import error when using Inheritence in Python. In a parent
I have a funny thing going on with my local dev setup. Using codeigniter
I have a kind of funny and weird requirement this time. I have my

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.