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

  • Home
  • SEARCH
  • 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 6907785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:28:43+00:00 2026-05-27T08:28:43+00:00

I need to open a modal dialog after the Firefox extension is launched, and

  • 0

I need to open a modal dialog after the Firefox extension is launched, and then close it after certain conditions.

I defined the dialog with an id = 'myWindowName' in the XUL file, and then launch it using window.openDialog('xul url', 'myWindowName', ...) directly without assigning it to any variable.

Then, I define y = document.getElementById('myWindowName') in a later function and use y.cancelDialog() to close it.

So far, it looks as though it’s working, but I wanted to ask if this method is correct.

Does y=window.openDialog("url', 'myWindowName', ...) return the same reference as y=document.getElementByID('myWindowName') ?

Also, why doesn’t window.cancelDialog() work? Is window.close() a better option to autoclose the dialog?

  • 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-27T08:28:43+00:00Added an answer on May 27, 2026 at 8:28 am

    Read Working with windows in chrome code.

    It seems that you don’t know that there is more than a single “scope” in Firefox (and in regular web pages). What I mean is: every window, tab, and iframe has its own set of objects (global object, which is the Window object, document etc). In addition to that sometimes there are “scopes” with their own global object, but no DOM (no window or document) – XPCOM components, jsm modules, workers, sandboxes.

    openDialog returns the window object of the new dialog. The <dialog id='myWindowName'> element can be accessed in that window’s document, the syntax depends on where the script, that wants to access it, runs: if it runs in the dialog, it can use document.getElementById(), while a script in another window has to access it through a reference to the dialog’s window (say, dialogWindow): dialogWindow.document.getElementById().

    cancelDialog is a method on the XUL <dialog> element, while close() is a window‘s method, which is why window.cancelDialog() doesn’t work, while window.close() does.

    As to which of dialog.cancelDialog or window.close() is “better”: cancelDialog does more than a simple window.close() (see its code on mxr) — the same steps as when the Cancel button on the dialog is pressed. So before closing the window, it checks if the dialog’s Cancel button is disabled, then fires ondialogcancel event letting interested code to prevent that from happening, then if everything’s ok, it closes the window via window.close().

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

Sidebar

Related Questions

I need a modal dialog to open ontop of an tinyMCE editor and other
In order to open a modal dialog, you need to pass a parent window,
I need to Open a process (easy) and then somehow paste data from my
When I am increasing size of dialog after opening it then dialog height and
On pdf downlaod link need to open a jQuery dialog and have a form
I need to run jQuery modal dialog if mainOptim.php returns 0. Now Firebug says
I have a modal dialog in Wicket that contains a link. I need to
I need a jquery form dialog that calls a function with two parameters after
I have a link in a dialog modal window. I need this link to
I need to open (call) a ui-dialog box from a function javascript. Currently I

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.