Link to home
Start Free TrialLog in
Avatar of angelsofgrace2006
angelsofgrace2006Flag for Portugal

asked on

Code to set default homepage

Hi,

I need a function (I presume in JavaScript) that sets a web site I'm making as the default homepage both in Firefox and Internet Explorer by clicking a link.

Problem is that googling, I can only find code that works in Intenet Explorer.

Does anyone knows of some piece of code that works both in Firefox and Internet Explorer ?

Any help would be appreciated.

Warm Regards,
Mário Gamito
Avatar of David S.
David S.
Flag of United States of America image

Only IE would provide a feature like that.

All you can do is ask your users to do it manually in Firefox and other browsers.
@Kravimir: Love your sense of humor!

This page has a fairly comprehensive collection of links for various browsers.
http://www.afscme.org/about/4321.cfm
Of course, in the age of tabbed browsing, simply making a bookmark might be close enough.  And if you really wanted to be pushy about it (not recommended) you might be able to trigger the javascript with body onload or some similar action.  Like I said, not recommended.  Better to let your clients click a link.
<script language="JavaScript" type="Text/Javascript"><!-- // Hide script from older browsers 
var urlAddress = "http://www.XXX.html"; 
var pageName = "Free Lunch"; 
function addToFavorites() { 
    if (window.external) { 
        window.external.AddFavorite(urlAddress,pageName) 
    } else { 
        alert("Sorry! Your browser doesn't support this function."); 
    } 
} // --></script>
 
 
<a href="javascript:addToFavorites()">Bookmark This Page</a>

Open in new window

Avatar of angelsofgrace2006

ASKER

Hi,

That's not true. It might be tricky, but possible.
Go to http://www.yahoo.com with Firefox.

Regards,
Mário Gamito
Hi Ray,

Thank you for your answer, but that's not what I've asked. I already wrote the code to add the site to Bookmarks(FF)/Favorites(IE).

What I want is to click on a link and set the site as the default browser's homepage.

Best Regards,
Mário Gamito
Mario: I looked at Yahoo with FF, but couldn't find a clickable link.  Instead, with a little searching, I found this:
http://www.yahoo.com/bin/set?home=my.yahoo.com&prop=My+Yahoo! 

Give me a little more of a clue to what you found at Yahoo.

Cheers, ~Ray
Hi Ray,

Go to http://www.yahoo.com with Firefox and click on "Make Y! your home page".

It seems that this the only technique available to do the trick in Firefox.
I also found it in other places, loke http://www.aeiou.pt
It's a portuguese site. In Firefox you'll have to drag the house icon to the Firefox "Home" button to set it as the default homepage, just like in Yahoo's.

Warm Regards,
Mário Gamito
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

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
Hi Ray,

Thank you so much for your answer.
Indeed, it did the trick :)

500 point well woned :)

Warm Reagrds,
Mário Gamito