1

Edit: I was able to go one step further :)

PSEUDO CODE (what I want)

if (CurrentTabURL == empty Tab) and (Tab.Count == 1)
{close Firefox}
else
{close Tab}

MY CODE (only the if statements don't work. Both actions are working)

if  (gBrowser.currentURI == "") 
    and (tabbrowser.browsers.length == 1)
then  
    goQuitApplication();
else
    gBrowser.removeTab(gBrowser.mCurrentTab);
end

This link helped me a lot.

1 Answer 1

1

gBrowser.currentURI is an nsIURI instance. If you want to compare the URL to a string you should look at gBrowser.currentURI.spec. The URL of an "empty tab" is about:blank by the way. Also, I guess that you want to use JavaScript? Corrected code:

if (gBrowser.currentURI.spec == "about:blank" && gBrowser.browsers.length == 1)
  goQuitApplication();
else
  gBrowser.removeTab(gBrowser.selectedTab);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.