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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:56:28+00:00 2026-06-18T02:56:28+00:00

I have this JS code: window.open(loginurl, ‘_blank’); coming from a condition for example: if

  • 0

I have this JS code:

window.open(loginurl, '_blank');

coming from a condition for example:

if (userloggedin) {

//popup another page

} else {

window.open(loginurl, '_blank');

}

“loginurl” is an login URL that I would like to open in new window.

Problem: This will be blocked in most browsers (Firefox and Chrome) because it behaves like a popup.

I would like a solution that will still utilizes my login URL variable (not altering the if else statement), open it in new window without any warnings of a popup that is being blocked.

I am searching for ways but I never found a solution. If somebody can provide some tips or insights. That would be highly appreciated.

Thanks.

  • 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-18T02:56:29+00:00Added an answer on June 18, 2026 at 2:56 am

    The window opened by window.open will always be regarded as a pop-up to block by browsers when the function is triggered without a user action initiating it.

    That means that for example that these will not be blocked:

    $('a').on('click.open', function(e) { e.preventDefault(); window.open('http://disney.com') });
    

    Chrome even allows other events to trigger the popup, while firefox will not allow this:

    $(document).on('keydown', function(e) { window.open('http://stackexchange.com') });
    

    And this will be blocked:

    $(document).ready(function() { window.open('http://stackoverflow.com') });
    

    So, unless you’re triggering the window.open after a user action, you can never be sure that your window won’t be blocked.

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

Sidebar

Related Questions

I have this code to open an html window from air : _win =
I have this HTML code <div class=anc-style onclick=window.open('./view.php?a=foo')></div> I'd like to extract the contents
I have this code in a child window (popup): function confirmation() { var answer
Simple question, I have a window that was opened with this code window.open(URL, windowName,
I have this code: $(window).bind('beforeunload', function () { $(#dialogsendnotifications).dialog('open'); }); $(#dialogsendnotifications).dialog({ autoOpen: false, closeOnEscape:
I have this code: public class Window extends JFrame { public Window(){ ... JButton
I have this code inside a iframe: window.addEventListener('message', function(e){ if(e.data == 'test') console.log(e); },
I have this code which draws a Window and NSView, and have set up
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var

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.