2

Which Firefox API calls would you use to change homepage in Firefox programmatically?

The purpose is to create a Firefox extension that is able to cycle through a few favourite pages (this is analogical to cycling through a few wallpapers on the desktop).

Cœur
  • 37,241
  • 25
  • 195
  • 267
xralf
  • 3,312
  • 45
  • 129
  • 200

1 Answers1

3

You can change the Firefox homepage by setting the preference "browser.startup.homepage".

The easiest way to do this in an add-on via JavaScript is:

Components.utils.import("resource://gre/modules/Services.jsm");
Services.prefs.setCharPref("browser.startup.homepage", "http://mike.kaply.com");
Aleksander Azizi
  • 9,829
  • 9
  • 59
  • 87
Mike Kaply
  • 747
  • 3
  • 12