Hi,
I've seen on a few sites, links to make that website your default homepage - does anyone know the code for this?
Thanks
Kam
| SitePoint Sponsor |
Hi,
I've seen on a few sites, links to make that website your default homepage - does anyone know the code for this?
Thanks
Kam

try this:
Jason WeinsteinCode:<script languag=JavaScript> function setHomepage(f) { if (f.style != null) { f.style.behavior='url(#default#homepage)'; f.setHomePage('http://www.yoursite.com/') } else { alert("Your browser does not support this function."); } } </script> <a href="#" onClick="setHomepage(this);return false;">Make This My HomePage</A>
webmaster@MaximumEdge.com
http://www.MaximumEdge.com/
Although you may not desire that "Your browser does not support this feature" message. Here's one that always includes the text but only makes it a link if the browser supports that function. It is only a link on IE though.
You might want to use a combination between this and maximumedge's code.
Code:<script language="JavaScript"><!-- pageurl="http://amphigory.8m.com/"; pagetitle="The Mostly Amphigory Website"; if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) { var sText = "<U><SPAN STYLE='color:navy;cursor:hand;'"; sText += "onclick='window.external.AddFavorite(pageurl,"; sText += "pagetitle);'>"; document.write(sText); } // --> </script> Keep up to date - bookmark this page <script language="JavaScript"><!-- if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) { document.write("</SPAN></U>"); } // --> </script>
Last edited by mmj; Apr 25, 2001 at 06:34.
[mmj] My magic jigsaw
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Bit Depth Blog · Twitter · Contact me
Neon Javascript Framework Jokes


Jason does this work in NS as well as IE?Originally posted by maximumedge
try this:
Jason WeinsteinCode:<script languag=JavaScript> function setHomepage(f) { if (f.style != null) { f.style.behavior='url(#default#homepage)'; f.setHomePage('http://www.yoursite.com/') } else { alert("Your browser does not support this function."); } } </script> <a href="#" onClick="setHomepage(this);return false;">Make This My HomePage</A>
webmaster@MaximumEdge.com
http://www.MaximumEdge.com/
O.T.
I have noticed you have provided some excellant answers on a variety of subjects. Nice website. I particularily like the map function. How is this done? Do you keep the map on your database or just refer to another. Can anyone do this on their site.





You all include option to show an alert etc.
How about totally concealing it in NS?
Why show the user when its not going to be of use anyway?
"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
-- Albert Einstein

the automatic setting of the homepage only works in IE. if the browser doesn't support it then it alerts the user with a message.Originally posted by gthorley
Jason does this work in NS as well as IE?
the idea i meant was that you could provide useful information in the alert box instead of what i put in the code. for example, on my site i provide detailed instructions in the alert box on how to change their homepage in netscape by changin their preferences when their browser doesn't support this function. also, it's a subtle way of convincing users to set your site as their homepage.Originally posted by lynlimz
You all include option to show an alert etc.
How about totally concealing it in NS?
Why show the user when its not going to be of use anyway?
Jason Weinstein
webmaster@MaximumEdge.com
http://www.MaximumEdge.com/





Yes. You have a point.
"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
-- Albert Einstein





Any JavaScript bookmark utilities do not work in Netscape, as there is no current method for a JavaScript coder to access Netscape's bookmark DOM.
Thus, all bookmark scripts only work in IE![]()
Bookmarks