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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:12:45+00:00 2026-06-06T16:12:45+00:00

I have a button: <button>Click</button> I want click it and open a new window

  • 0

I have a button:

<button>Click</button>

I want click it and open a new window in the same page, I bind the click event an event handle:

$('button').click(function () {
    var newurl="http://" + window.location["host"] + ";
    window.open(newurl, '_parent');
})

But is always open in new tab or new window, the second parameter I have try _self _top.
I even have try window.location.href(newurl)

So how can I solve this problem?Does it matter with browser or OS? I view it in Mac OS’s firefox and chrome.

  • 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-06T16:12:46+00:00Added an answer on June 6, 2026 at 4:12 pm

    Well that’s not possible technically, it also depends on browser tab settings, window settings and third party tab manipulation plugins or addons.


    Update

    OP has cleared the confusion of all through his comment below his question, this is what you need to set a new url for current window:

    $('button').click(function () {
        var newurl="http://" + window.location["host"];
        window.location.href = newurl; // or simply window.location
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to open a new window in button click.I have used a code.
I have MainWindow with a button, under the button click event I want MainWindow
I have an application page. I want to click a button to pop out
I want my php to open a new html page. I have a html
I have an html page. On that page I want to open popup window.
in my web application I have a button when I click I want to
I have two tables on a webform. On a button click I want to
I have a form which I want to submit upon button click which is
I want to finish the Activity on Home Button Click . I have below
I have two button name A, and B want to click them equal to

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.