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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:11:42+00:00 2026-05-21T11:11:42+00:00

I want to open a popup window and disable the parent window. Below is

  • 0

I want to open a popup window and disable the parent window. Below is the code that I am using;

function popup()
{

    popupWindow = window.open('child_page.html','name','width=200,height=200');
    popupWindow.focus();
}

For some reason, the parent window does not get disabled. Do I need some additional code OR what is the case?

Again, I am looking for something similar to what we get when we use showModalDialog()..i.e. it does not allow to select parent window at all..Only thing is I want to get the same thing done using window.open

Also please suggest the code which will be cross-browser compatible..

  • 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-21T11:11:43+00:00Added an answer on May 21, 2026 at 11:11 am
    var popupWindow=null;
    
    function popup()
    {
        popupWindow = window.open('child_page.html','name','width=200,height=200');
    }
    
    function parent_disable() {
    if(popupWindow && !popupWindow.closed)
    popupWindow.focus();
    }
    

    and then declare these functions in the body tag of parent window

    <body onFocus="parent_disable();" onclick="parent_disable();">
    

    As you requested here is the complete html code of the parent window

    <html>
    <head>
    <script type="text/javascript">
    
    var popupWindow=null;
    
    function child_open()
    { 
    
    popupWindow =window.open('new.jsp',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");
    
    }
    function parent_disable() {
    if(popupWindow && !popupWindow.closed)
    popupWindow.focus();
    }
    </script>
    </head>
    <body onFocus="parent_disable();" onclick="parent_disable();">
        <a href="javascript:child_open()">Click me</a>
    </body>    
    </html>
    

    Content of new.jsp below

    <html>
    <body>
    I am child
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html page. On that page I want to open popup window.
I've got a popup window opened using window.open() . What I want now is
I am opening a popup window from javascript using window.open. I want to open
I want a popup window in html that has no orders or menus etc
I call below javascript on click of link/textbox or button. function OpenPopupLinkRisk(Number) { window.open(../PopUp.aspx?id=
I opened a popup window by window.open in JavaScript, I want to refresh parent
I'm new to VSDO, and i want to open new template/word popup window within
I want to open an xlsx file, I have tried the below code,but neither
I want to open html files from a shell script. I know that Ubuntu
I want to open new url as a popup window on form submission. Can

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.