Log in

View Full Version : Set site as homepage Script



juzzo
12-31-2007, 09:24 PM
this script "Set site as homepage Script" http://www.dynamicdrive.com/dynamicindex9/addhome.htm# works
good with internet exprorer, but does not work in mozilla firefox. Does anyone know how to change script that would also work with firefox, or add
some code or something what would open pop-up window and says " Mozilla
Firefox doesn't allows this action".

jscheuer1
12-31-2007, 10:29 PM
Setting the homepage is a user preference. As far as I know, doing it any more actively than that is supported only in IE. There are somewhat cross browser 'set bookmark' scripts:

http://www.dynamicdrive.com/forums/showthread.php?t=17329

being the best discussion of such that I am aware of.

juzzo
12-31-2007, 11:47 PM
Setting the homepage is a user preference. As far as I know, doing it any more actively than that is supported only in IE. There are somewhat cross browser 'set bookmark' scripts:

http://www.dynamicdrive.com/forums/showthread.php?t=17329

being the best discussion of such that I am aware of.


ok, thanks, bookmark site works good with IE and firefox, but can I do than, this is just example, if you open http://www.google.com/ with IE on the botton of screen you can see "Make Google Your Homepage!" but if you open the same link with Mozilla Firefox then you don't see that message.
Do you know how to do that? I mean hide (do not show) "Set site as homepage" message when site is open with Firefox.

jscheuer1
01-01-2008, 05:50 PM
This will do it similar to how Google does it. The link will only be seen in IE 5+, and only if the page that this code is on is not already the user's homepage.
This will only work on a live page:


<!--[if IE]>
<span id="hp" style="behavior:url(#default#homepage)"></span>
<a href="#"
onclick="var HomePage=window.location.href;
document.getElementById('hp').setHomePage(HomePage);window.location=window.location;return false;"
><script type="text/javascript">;(function(){var HomePage=window.location.href;
if(!document.getElementById('hp').isHomePage(HomePage)){document.write(''+
// Set Below to desired Link Text or Image Tag:
'Click here to make Dynamic Drive your default homepage'
+'')};})();</script></a>
<![endif]-->

Edit the highlighted part as needed.

juzzo
01-01-2008, 07:57 PM
This will do it similar to how Google does it. The link will only be seen in IE 5+, and only if the page that this code is on is not already the user's homepage.
This will only work on a live page:


<!--[if IE]>
<span id="hp" style="behavior:url(#default#homepage)"></span>
<a href="#"
onclick="var HomePage=window.location.href;
document.getElementById('hp').setHomePage(HomePage);window.location=window.location;return false;"
><script type="text/javascript">var HomePage=window.location.href;
if(!document.getElementById('hp').isHomePage(HomePage)){document.write(''+
// Set Below to desired Link Text or Image Tag:
'Click here to make Dynamic Drive your default homepage'
+'')};</script></a>
<![endif]--

Edit the highlighted part as needed.


well, now I can see "Click here to make.....homepage" message with IE, and I don't see that message when I open with Firefox, it supposed to be that way, but still something doesn't work right. When I click, nothing happens. On the botton of IE screen, says, "error on page"
But anyway, thanks a lot for trying.

jscheuer1
01-01-2008, 08:06 PM
I think you missed this bit:


This will only work on a live page

Oh, and I did leave out the very last > (fixed now in the original) but, that wouldn't cause the error. The error you have is 'permission denied', you cannot make a local page your homepage using this code.

Demo:

http://home.comcast.net/~jscheuer1/side/home_page.htm

juzzo
01-01-2008, 09:13 PM
I think you missed this bit:



Oh, and I did leave out the very last > (fixed now in the original) but, that wouldn't cause the error. The error you have is 'permission denied', you cannot make a local page your homepage using this code.

Demo:

http://home.comcast.net/~jscheuer1/side/home_page.htm

Well, yes works great, you were right, I did miss that part "This will only work on a live page". thanks for help.