Home arrow Web Standards arrow Configuring Firefox for Chrome and a Server

Configuring Firefox for Chrome and a Server

If you have been building Internet applications with XUL, you'll appreciate this four-part article series. It explains how to prepare such an application for a commercial setting. This article is excerpted from chapter four of Programming Firefox, written by Kenneth C. Feldt (O'Reilly, 2007; ISBN: 0596102437). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
June 05, 2008
  1. · Configuring Firefox for Chrome and a Server
  2. · Running as a Local Installation
  3. · Package Registration
  4. · Configuring the Server

print this article

Configuring Firefox for Chrome and a Server
(Page 1 of 4 )

In this chapter, we will move our application from its home in a test directory to a setting that is more consistent with commercial implementations.

We will create two key pieces for implementing our application:

  1. A local XUL application communicating with a Personal Hypertext Processor (PHP) server
  2. A remote XUL application being served by PHP scripts

Both implementations will use an SQL database to hold user and password information to conduct the authentication process. Figure 4-1 shows a block diagram illustrating the relationship of the main elements of our design.

Figure 4-1.  NewsSearch information flow

Chrome Overview

This book uses the term XUL application to describe our NewsSearch project. This differs from conventional web applications that are designed to be served web pages that are rendered by web browsers. A XUL application, however, can be implemented as a page served to a XUL-capable browser, or it can be configured to run as an application local to the user’s machine. In the case of the latter, the files that comprise the application (JavaScript source, stylesheets, datafiles) are installed in a chrome directory and run as a chrome URL.

To date, the most popular XUL applications, such as the Firefox browser, Thunderbird mailer, and Sunbird calendar, are implemented as bundled applications running from the user’s chrome directory.

Web developers refer to traditional web applications as being subject to the rules of a security sandbox. Originating from the Java language’s security policy, the sandbox philosophy limits the reach of executable code to a certain area. For browsers, this means that unprivileged JavaScript can access data from a served document and from documents sharing its URL, but the browser infrastructure allows no access to the local filesystem or to potentially destructive operating system and network services.

There are cases when the local browser needs to store information on a user’s computer. This information may include bookmarks, runtime preferences, or other saved settings that would impair the user experience if not kept locally accessible; the sandbox is therefore expanded to include a controlled portion of the local filesystem. Applications that are registered within Firefox’s chrome are granted an area on the local disk to which full read/write access is granted.

In addition to meeting the security requirements imposed by the Firefox framework, a chrome application has a different look to it.

Before launching our code as a chrome application, we should change the testStyles.css stylesheet to provide a default background color for our window:

  window {

(The default window color is needed when launching a chrome application from the command line.)

To see what our test application would look like as a chrome application, open a command window and launch Firefox from the command line, specifying the
–chrome option along with the pathname to the source file. The –chrome option directs the framework to display the source as a chrome window, not as a browser window.

On an OS X machine, the code would look like this:

  theUser% pwd 
  theUser% /Applications/Firefox.app/ Contents/MacOS
  theUser% ./firefox -chrome "file:Macintosh HD:tests:theWindowWithLogin.xul"

Our NewsSearch application now appears as a chrome window with none of the controls we associate with a browser (see Figure4-2 ).

Simply launching an application with the–chromeoption and a file URL will give us a chrome appearance, but to run it as a client/server chrome application, we will need to install the application as a chrome package, or serve the interface as a XUL page.

Figure 4-2.  Application launched as a chrome window

blog comments powered by Disqus

- Mozilla Popcorn Maker 1.0 Makes Videos More...
- Completing a Configuration for Chrome and a ...
- Getting Connected with Firefox and Chrome
- Configuring Servers and Databases with Chrome
- Configuring Firefox for Chrome and a Server
- Designing the Elements of a Web Page
- Matching div heights with CSS and JavaScript
- Forms
- Get Down With Markup
- If I Said You Had a Beautiful Body...
- Web Standards in Dreamweaver Part 3
- Web Standards in Dreamweaver, Part 2
- Web Forms
- Making Lists Using XHTML
- Web Standards in Dreamweaver, Part 1

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials