Your Search Results

    Services.jsm Redirect 1

    The Services.jsm JavaScript code module offers a wide assortment of lazy getters that simplify the process of obtaining references to commonly used services.

    To use it, you first need to import the code module into your JavaScript scope:


    Then you can obtain references to services by simply accessing them from the Services object exported by the code module. For example, to obtain a reference to the preferences service:

    var prefsService = Services.prefs;

    Provided service getters

    Service accessor Service interface Service name
    androidBridge nsIAndroidBridge ¹
    appinfo nsIXULAppInfo
    Application information service
    appShell nsIAppShellService Application shell service
    blocklist nsIBlocklistService Blocklist service
    cache nsICacheService Cache service
    cache2 nsICacheStorageService Cache storage service
    clipboard nsIClipboard Clipboard
    console nsIConsoleService Error console service
    contentPrefs nsIContentPrefService Content Preferences service
    cookies nsICookieManager2 Cookie Manager 2 service
    crashmanager CrashManager.jsm  
    dirsvc nsIDirectoryService
    Directory service
    domStorageManager nsIDOMStorageManager DOM Storage Manager
    DOMRequest nsIDOMRequestService DOMRequest service
    downloads nsIDownloadManager Download manager
    droppedLinkHandler nsIDroppedLinkHandler Dropped link handler service
    eTLD nsIEffectiveTLDService EffectiveTLD service
    focus nsIFocusManager Focus manager
    io nsIIOService
    I/O Service
    locale nsILocaleService Locale service
    logins nsILoginManager Password Manager service
    metro nsIWinMetroUtils ²
    obs nsIObserverService Observer service
    perms nsIPermissionManager Permission manager service
    prefs nsIPrefBranch
    Preferences service
    prompt nsIPromptService Prompt service
    scriptloader mozIJSSubScriptLoader JavaScript subscript loader service
    scriptSecurityManager nsIScriptSecurityManager Script security manager
    search nsIBrowserSearchService Browser search service
    startup nsIAppStartup Application startup service
    storage mozIStorageService Storage API service
    strings nsIStringBundleService String bundle service
    sysinfo nsIPropertyBag2 System info service
    telemetry nsITelemetry Telemetry service
    tm nsIThreadManager Thread Manager service
    uriFixup nsIURIFixup URI Fixup service
    urlFormatter nsIURLFormatter URL Formatter service
    vc nsIVersionComparator Version comparator service
    wm nsIWindowMediator Window mediator service
    ww nsIWindowWatcher Window watcher service

    ¹ Mobile only
    ² Windows only

    See also

    Document Tags and Contributors

    Contributors to this page: teoli
    Last updated by: teoli,