Solved

Code to set default homepage

Posted on 2008-06-19
9
844 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

743 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

11 Experts available now in Live!

Get 1:1 Help Now