Forum Moderators: open
I warned him that this would turn off a lot of 56K users, or people who didn't have the Flash plugin.
So, I created two versions of each page: one with all the Flash googaw, and one that was very straightforward HTML.
The "googwaw" page is widgets2.html. The straightforward page is widgets1.html. The page that people actually find and click on is widgets.html, which has the redirect script.
A Frankensteined script I put together decides which users go to which version. It actually works very well..
However, I've received a few complaints from users of the site that they can't use the back button on their browers, since the redirect page sends them right back to either widgets2.html or widgets1.html.
Obviously, I'm no Javascript expert. But I'm wondering if there's a way to let users who've reached the widget2.html or widget1.html page use their backbuttons without having to click two or three times (which few users will do).
Any suggestions, criticisms, ideas much appreciated.
// page to go to if cookie exists
go_to = "index1.html";
// number of days cookie lives for
num_days = 5;
function ged(noDays){
var today = new Date();
var expr = new Date(today.getTime() + noDays*365*24*60*60*1000);
return expr.toGMTString();
}
function readCookie(cookieName){
var start = document.cookie.indexOf(cookieName);
if (start == -1){
window.location="indexa.html";
} else {
window.location = go_to;
}
}
readCookie("Low");
// -->
And here's the script that checks connection speed:
<SCRIPT>
<!--
time = new Date();
endtime = time.getTime();
millitime = (endtime - starttime);
downloadtime = millitime/1000;
bits = 204800;
bytes = bits/8;
kbytes = bytes/1024;
linespeed = kbytes/downloadtime;
kbits_s = (Math.round((linespeed*8)*10*1.02))/10;
if (kbits_s<560)
{window.location=("/index1.html");}
else
{window.location=("/indexb.html");}
// -->
</SCRIPT>
The third redirect page has a Flash sniffer.
Any ideas on how to modify one of these scripts would be very welcome.
Let's say your domain name is "mysite.com"
"isGood.html" is the page for people who have an adequate connection speed
"isBad.html" is the page for people who are speedy-connection-challenged
indexCheck.html:
<SCRIPT language="javascript" type="text/javascript">
<!--
contain="mysite.com";
time = new Date();
endtime = time.getTime();
millitime = (endtime - starttime);
downloadtime = millitime/1000;
bits = 204800;
bytes = bits/8;
kbytes = bytes/1024;
linespeed = kbytes/downloadtime;
kbits_s = (Math.round((linespeed*8)*10*1.02))/10;if (kbits_s<560 && document.referrer.indexOf(contain) == -1)
{window.location=("isBad.html");}
else if( document.referrer.indexOf(contain) == -1)
{window.location=("isGood.html");}// -->
</SCRIPT>
Are you saying that I should change this line of code: {window.location=("/index1.html");}
to {location.replace("/index1.html");}
Or should I change it to {window.replace.location=("/index1.html");}
Thanks very much for your indulgence.
Dick
There are several instances where location is used. I would have to analyse the code to be sure but, in all probability, all these instances will have to be modified.
Wherever you have location=url or location.href=url or location=(url) it must be replaced with location.replace(url)
You should leave other punctuation such as semicolons and curly-brackets unchanged ie if a semicolon follows the statement you are editing, you must not delete it and if the url value is in quotes they must not be deleted.
Kaled.