Advertisement:

Author Topic: set as startpage script  (Read 1564 times)

raess

  • Full Member
  • ***
  • Posts: 240
set as startpage script
« on: March 19, 2011, 10:03:37 pm »
Hello! somebody knows how to get it working?
Code: [Select]
<script language="javascript">
function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
  document.body.setHomePage('http://www.asp.net/130.aspx');
 
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   { 
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
         } 
         catch(e) 
         { 
    alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change 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','http://www.asp.net/130.aspx');
 }
}
</script>
<input type="button" value="set home page" onclick="setHomepage();" />