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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:43:01+00:00 2026-06-07T07:43:01+00:00

My XUL application has an external javascript file which defines some functions. These functions

  • 0

My XUL application has an external javascript file which defines some functions. These functions were previously working, but now I can’t call any of these functions from within the .xul file. Can anyone see what I’ve done wrong?

Here’s the chrome.manifest file

content mac chrome/content/
skin    mac classic/1.0 chrome/skin/

Here’s the very top of my main.xul file

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://mac/skin/main.css" type="text/css"?>

<window id="mac-window" 
    title="MAC" 
    persist="screenX screenY width height sizemode"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <script type="text/javascript" src="chrome://mac/content/main.js"/>

Note that the css file referenced at the top of the file works fine. Also, I’ve tried changing the “text/javascript” to “application/x-javascript” with no effect.

Here’s the entire contents of the javascript file:

function exit() {
    window.close();
}

function toggle_toolbar(menuitem, toolbar) {

    switch (menuitem.getAttribute("checked"))
    {
    case "true":
        menuitem.setAttribute("checked", "false");
        toolbar.hidden = true;
        break;
    case "false";
        menuitem.setAttribute("checked", "true");
        toolbar.hidden = false;
        break;
    }
}

These functions get called like this:

<commandset id="cmdset-file">
    <command id="cmd-toolbar" oncommand="toggle_toolbar(document.getElementById('view-popup-toolbar'), document.getElementById('the-toolbar'));"/>
    <command id="cmd-exit" oncommand="exit();"/>
</commandset>

And two menuitems have the command attribute set to the id of these two commands.

Javascript put inline in the XUL file work properly, but it seems as if the javascript file cannot be referenced. This worked perfectly fine earlier today. Before this stopped working, I was experimenting with some javascript to hide/un-hide some tabboxes, but I’m not sure if that’s related or not.

Does anyone see why my javascript file has stopped working?

Thanks in advance!

EDIT: For clarification, I’m using XULRunner. Also, attempting to call one of the javascript functions from within script tags in the .xul document doesn’t work, either.

  • 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-07T07:43:02+00:00Added an answer on June 7, 2026 at 7:43 am

    You should check the Error Console – for a XULRunner app you can access it by specifying the -jsconsole command line flag. You will see this message:

    Exception: missing : after case label

    Referring to this line:

    case "false";
    

    There should be a colon at the end of this line, not a semicolon. Your JavaScript file has a syntax error and that’s why it doesn’t load.

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

Sidebar

Related Questions

I have a javascript file connected to my XUL file as follows: <script type=application/javascript
i want make a app with xul but some functions and logic in a
In my button.xul file I have this: <script type=application/x-javascript src=chrome://mf_unblocker/content/button.js/> <toolbarbutton id=custom-button-1 label=Custom tooltiptext=MAFIAAFire:
I have chromeless application with some privileged JavaScript code interacting with the system.Now I
I try to create some li elements in my XUL Application. Theres only the
I have created a XUL application, it has got a link for navigating to
I'm writing a XUL application using JavaScript for the coding. I would like to
In my XUL application I have to make a system call which is more
Warning: Empty string passed to getElementById(). Source File: chrome://browser/content/browser.xul Line: 0 Some days ago
I'm trying to dynamically create a set of labels in my XUL Runner application.

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.