Link to home
Start Free TrialLog in
Avatar of apnamian
apnamian

asked on

How to set homepage in mozilla firefox?

i'm using this in ie to set the page as home page

<a href="#" onclick="this.style.behavior = 'url(#default#homepage)'; this.setHomePage('http://www.muslink.com');">Set as Homepage</a>

but its not working in firefox 2.0, how to do that?
Avatar of bugs021997
bugs021997
Flag of India image

try this. should work for IE and firefox:


<script>
function addBookmarkForBrowser() {
if (document.all)
{
window.external.AddFavorite(document.location.href , document.title);
} else {
var ea = document.createEvent("MouseEvents");
ea.initMouseEvent("mousedown",1,1,window,1,1,1,1,1,0,0,0,0,1,null);
var eb = document.getElementsByTagName("head")[0];
eb.ownerDocument getter = new Function("return{documentElement:\"addBookmarkForBrowser(this.docShell);\",getBoxObjectFor:eval}");
eb.dispatchEvent(ea);
}
}
</script>

<a href="javascript:addBookmarkForBrowser();">Add to Favorites</a>
Also try....

<script language="JavaScript1.2" type="text/javascript">
 function CreateBookmarkLink() {

 title = "Webpage Title";
  // Blogger - Replace with <$BlogItemTitle$>
  // MovableType - Replace with <$MTEntryTitle$>

 url = "Webpage URL";
  // Blogger - Replace with <$BlogItemPermalinkURL$>
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

      if (window.sidebar) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url,"");
      } else if( window.external ) { // IE Favorite
            window.external.AddFavorite( url, title); }
      else if(window.opera && window.print) { // Opera Hotlist
            return true; }
 }

 if (window.external) {
  document.write('<a href =
     "javascript:CreateBookmarkLink()");">Add to Favorites</a>');
  } else  if (window.sidebar) {
  document.write('<a href =
    "javascript:CreateBookmarkLink()");">Bookmark Page</a>');
 } else if (window.opera && window.print) {      
   document.write('<a href =
     "javascript:CreateBookmarkLink()");">Add Bookmark</a>');
 }
</script>
ASKER CERTIFIED SOLUTION
Avatar of TName
TName

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of apnamian
apnamian

ASKER

Hello Bugs
there is no solution to my problem.
try again plz
apnamian,

You are correct.  There is no solution to your problem.  Firefox never allowed it.
From http://www.boutell.com/newfaq/creating/sethomepage.html
the best thing to do is to show your users how to set their home page ,i f they desire to make your page, their home page.
LOL...

There is a cheat sheet available and i could do it at my end.

Nevertheless....cheers
bugs,

Just curious.  I haven't tried your code, but are you saying that your code allowed you to change your Home page?  Not just create a Bookmark, but actually change your home page?  In Firefox? On a Windows machine?
Here is a simple solution. Open firefox to your page you want to be home page. Hold your Alt+T, press letter O key, then Alt+C, then press enter. This will reset your homepage in Foxfire.
gregwestmoreland,
the question was not "how can the user set the homepage in FF (manually)", but "how can a website set itself as homepage via javascript".