[thelist] How can a redirect occur before onload?

Terry Fowler one_webdude at yahoo.com
Thu Dec 21 12:06:52 CST 2000


--- "Herzog, Ari" <Ari_Herzog at Instron.com> wrote:
> This is a question from a co-worker.
> I include his question here:
> 
> --
> Is there a way you know of to send a user
> to a different version of a page before the
> whole page downloads

I work on an intranet with PCs, HP workstations, and
Sun workstations. The default font on the Suns is 
much smaller than on the HPs and PCs, so I had a
page that sniffs for OS and serves up a Sun version
or a default version for everybody else. Looks like
this:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Redirect Page</title>
<!--
<LINK REL="stylesheet" TITLE="sunOS stylesheet"
HREF="blk12_pc.css">
-->

<SCRIPT LANGUAGE="JavaScript">    
function Is() {
var agent  = navigator.userAgent.toLowerCase();
this.win   = (agent.indexOf("win")!=-1);
this.sun   = (agent.indexOf("sunos")!=-1);
this.hp    = (agent.indexOf("hp-ux")!=-1);
}
var is = new Is();
</SCRIPT>

</HEAD>
<BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0"
   MARGINHEIGHT="0" MARGINWIDTH="0">     
<SCRIPT LANGUAGE="JavaScript">  
if (is.win) { window.location ="index_default.html"; }
else if (is.hp) { window.location
="index_default.html"; }
else { window.location ="index_sunos.html"; }
</SCRIPT>
</BODY>
</HTML>

So, since there's nothing in the body of this page
to show in the browser, nothing shows up. It's 
pretty much transparent and since there's not much
there the delay is negligible. Maybe this approach 
will help.

BTW, you may have noticed that all of this was couched
in the past tense. I finally got smart and changed 
my style sheets to use pixels instead of points and
no longer have to serve up different pages.

HTH,

Terry Fowler

PS - hmm, I notice some text wrapping in my email 
     editor, so heads up.



__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/




More information about the thelist mailing list