Solved

Code to set default homepage

Posted on 2008-06-19
9
846 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 42

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 108

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 108

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
 

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 108

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 108

Accepted Solution

by:
Ray Paseur earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now