Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Code to set default homepage

Posted on 2008-06-19
9
Medium Priority
?
860 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:angelsofgrace2006
  • 4
  • 4
9 Comments
 
LVL 43

Expert Comment

by:David S.
ID: 21821290
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.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 21821387
@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
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 21821446
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

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:angelsofgrace2006
ID: 21821455
Hi,

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

Regards,
Mário Gamito
0
 

Author Comment

by:angelsofgrace2006
ID: 21821476
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
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 21821724
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
0
 

Author Comment

by:angelsofgrace2006
ID: 21821817
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
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 21822368
Mario:

Sorry, I don't get a link to "Make Y! your home page" - it's not showing on my browser, and I searched the Yahoo page -- the text just isn't there.

But this seems to work in FF (you have to drag the link and confirm the change).  You can see it in action here: http://www.laprbass.com/RAY_homepage.html

Does that help? ~Ray
<html>
<body>
 
<script language="JavaScript1.1" type="text/javascript">
//<![CDATA[
		if (document.all) {
			document.write('<a class="a" href="javascript:history.go(0);" onclick="');
			document.write("this.style.behavior='url(#default#homepage)';this.setHomePage('"+document.location.href+"'");
			document.write(');">');
			document.write('Make This Your Homepage<\/a>');
		} else if (document.getElementById) {
			document.write('<a href="'+document.location.href+'" onclick="alert(');
			document.write("'Drag that link onto your Home Page Icon to Make '+document.location.href+' Your Homepage')");
			document.write(';return false;">Make This Your Homepage<\/a>');
		}
//]]>
</script>
 
</body>
</html>

Open in new window

0
 

Author Comment

by:angelsofgrace2006
ID: 21823341
Hi Ray,

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

500 point well woned :)

Warm Reagrds,
Mário Gamito
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question