Click to See Complete Forum and Search --> : Set As Homepage


webdev1
07-31-2003, 12:09 PM
Ok guys and gals, heres a challenge. I want to set my page to a users homepage, but I don't want them to click a button or a link. I want it to happen onload of the body. We're changing the name of our site and want to automatically set it. I've tried two different things, both of which i'll include here and neither are working! Can someone help me out! THANKS!!

<html>

<head>
<style type="text/css">
<!--
@media all
{
IE\:HOMEPAGE {behavior:url(#default#homepage)}
}
//-->
</style>

<script language="javascript">
<!--
function fnSet()
{
oHomePage.setHomePage('http://dlconnect.dqe.com/');
event.returnValue = false;
}
//-->
</script>

</head>

<BODY onload="fnSet();" >

<!--[if IE 5]>
<IE:HOMEPAGE ID="oHomePage" />
<input type="button" value="Make NetSpade your homepage!" onclick="fnSet()" />
<![endif]-->

</body>
</html>

I also tried to use CFIFs rather than that <!--[if IE 5...

Here is the other way I tried it:
<body onload="javascript:history.go(0).style.behavior=\'url(#default#homepage)\';javascript:history.go(0).setHomeP age(\'http://www.YourWebSiteHere.com\');">

pyro
07-31-2003, 12:13 PM
Thankfully, you can't do this without it alerting users...

webdev1
07-31-2003, 12:16 PM
I realize it's gonna ask the user 'do you want to set your homepage to blah blah blah', thats ok, but can't you automatically start the process when the page loads using body onload? i.e. When the page loads, it pops up a box that says, 'Do you want to set your homepage to blah blah blah?' Thanks.

pyro
07-31-2003, 12:48 PM
I would think most uses would find that very annoying. I certainly would. You'd be far better off including a link to do it... If I visited a site it asked to be made my homepage, it would be my last visit...

Anyway, you can do it, if you still think it's a good idea:

<script type="text/javascript">
function setPage() {
if (!hp.isHomePage("http://www.infinitypages.com"))
hp.setHomePage("http://www.infinitypages.com");
}
</script>
<body onload="setPage()">
<span id="hp" style="behavior:url(#default#homepage)"></span>