Script to Change Home Page of Browser

Sometime We want to set the Home Page of Visitor Browser with our site. So that when he/she starts the browser, our site will be opened. You have seen this very often that When you download or installed a software or Add-on your home page is changed.

So today i am presenting to you a small JavaScript Code which will be able to change home Page of visiter.

<script language="javascript">

 if (document.all)
    {
      var url=document.getElementById(Home).value;
      document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage('http://www.techinspirit.com');

    }
    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.techinspirit.com');
 }

</script>

Just Copy  the Script and Paste it to Body of your Home Page, and change “www.techinspirit.com” to your site(www.example.com) and Home Page of Victim’s Browser Will Be changed to whatever you set…

Comments are closed.