Make Homepage

I have a website that allows users to create a web page that’s an extension of my main website…for example, if their user name is “sample”, there website would be www.mylasthomepage.com/sample

I am looking to create a button or link that, when clicked. will automatically set their page as their homepage. Can someone help me with what I am doing wrong. So far I have this, but its obviously not working.

<?php require("inc/menuModify.php"); Make This Your Homepage "; ?>

Making a page as default homepage in a browser could be performed by javascript in some browsers. But most of modern browsers have this feature disabled by default, because of security reason. Here is the code that should work for IE and FireFox:

<script type="text/javascript"> function makeHomepage(){ 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 action is not available in your browser."); } } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage',location.href); } return false; } </script>

Place the code above within tags of your page, then use this link on the same page in the body of page:

<a href="javascript:;" onclick="makeHomepage();">Make homepage</a>
Sponsor our Newsletter | Privacy Policy | Terms of Service