Jeg har ikke testet det, men prøv dette:
<script language="JavaScript"><!--
// Ask your user to make this their home page on their second visit
// Internet Explorer only
// You need to make a file called startpage.reg which looks like this,
// but without the double slashes (4 lines long)
// REGEDIT4
//
// [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
// "Start Page" = "
http://www.mydomain.com/my/site.html"// ***** Please leave this courtesy note in *****
// *
// * downloaded for free from
http://www.summerholiday.org/freecode/// *
// ***** Thank you *****
function NumberVisits()
{
NumVisits = GetCookie('Visits');
if (NumVisits == null)
{
NumVisits = 0;
}
NumVisits++;
SetCookie ('Visits', NumVisits, 28);
if (NumVisits == 2 &&
navigator.appName == "Microsoft Internet Explorer")
{
HomePage();
}
}
function HomePage()
{
if(confirm("Hi!\nWould you like to make My Homepage your start page?\nOK = Yes\nCancel = No"))
{
if(confirm("OK!\nWhen the next box appears,\nselect 'Open from current location'\nand then click 'OK'"))
{
this.location = "startpage.reg";
}
}
}
function GetCookie(cookieName)
{
var theCookie=""+document.cookie;
var ind=theCookie.indexOf(cookieName);
if (ind==-1 || cookieName=="") return null; var ind1=theCookie.indexOf(';',ind);
if (ind1==-1) ind1=theCookie.length;
return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
function SetCookie(cookieName,cookieValue,nDays)
{
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName + "=" +escape(cookieValue) + ";expires="+expire.toGMTString();
}
//--></script>
</HEAD>
<BODY ONLOAD="NumberVisits()">
<script language="JavaScript"><!--
if (navigator.appName == "Microsoft Internet Explorer")
{
document.write('<a href="java script:HomePage()">Click here to make My Homepage your start page!</a>');
}
//--></script>