Set as homepage: Code
Function setHomePage ()
{
If (Document. All)
{
Document. Body. style. Behavior = ' URL (# default # homepage) ' ;
Document. Body. setHomePage (location. href );
}
Else If (Window. Sidebar)
{
If (Window. Netscape)
{
Try
{
Netscape. Security. privilegemanager. enableprivilege ( " Universalxpconnect " );
}
Catch (E)
{
Alert ( " This operation is rejected by the browser. To enable this function, enter about: config in the address bar, and set the value of signed. Applets. codebase_principal_support to true. " );
}
}
VaR prefs = Components. classes [ ' @ Mozilla.org/preferences-service=1 ' ]. Getservice (components. Interfaces. nsiprefbranch );
Prefs. setcharpref ( ' Browser. startup. Homepage ' , Location. href );
}
}
(Alternatively, you can: <a href = "javascript:;" onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomePage (location. href); Return (false); "> set to homepage </a>)
Add to favorites:
Function addfavo ()
{
Window. External. AddFavorite (location. href, document. Title );
}