Page 1 of 1

"blank page" before new page loaded

Posted: Mon Jul 19, 2004 8:47 am
by zeugma
hi :D

this may be a slightly stupid question, and has nothing to do w/ php, so this could easily be the wrong place to ask it, but...

when a link is clicked in the site i am developing, the page goes blank for a second. the entire page is reloaded (i was using iframes, but had majjjor issues with resizing those to fit content on mac browsers). i assumed that considering all the images would be cached, this wouldn't be such a problem (it is quite a graphically-intensive site, though). i realllly don't want to go back to the issues that i had with iframes, and the client would be totally okay with the site as it is if this "blank page" issue were to be solved.

is there not a meta-tag or something that can delay a site's rendering until there is something to render? why do some sites (sometimes ones with heavy graphics, that load the full page on every mouseclick) not have this blank page effect?

the site is accessing a database, too, so i'm thinking it could have something to do with the connecting to the database after every click.

anyway, thanks in advance for any response.

Posted: Tue Jul 20, 2004 11:30 am
by Vincent Puglia
Hi zeugma,

Without seeing any code, it's kind of difficult to speak with authority...but,

The dbms reconnection could be causing it. Why don't you create a displayed div/span with some text ('loading') and kill its display with the onload event handler?

Something like:

Code: Select all

<html>
<head>
<script type='text/javascript'>
document.write("<div id='theDiv' style='position:absolute;left:0px;top:0px;display:block'>Please wait...Loading</div>")
....whatever code you presently have....
function killDiv(divID)
{
  document.getElementById(divID).style.display = 'none';
}
</script>
<body onload="killDiv('theDiv')">
....
</body>
</html>
Vinny

Posted: Tue Jul 20, 2004 11:37 am
by feyd
note: that will require some alteration to work in browsers other than Mozilla based.. as well as output the div inside the body..

Posted: Tue Jul 20, 2004 12:00 pm
by Vincent Puglia
feyd wrote: require some alteration to work in browsers other than Mozilla based
Hi feyd,

Actually, it will work with any version 5+ browser, IE included. I'm presuming you referring to the doc...getElement... construct and thinking of document.all...

doc..all is primarily an IE4-thingy; IE5+ uses it backward compatibility mode. In normal mode, it uses doc..getElementBy... just like every other version 5+ browser (Moz, Opera, etc.)

Off-topic: when testing for browser versions, you must first decide where you want the newer IEs to fall.

Code: Select all

if (document.getElementById) // ie5+ falls in here
  ...code...
else if (document.all)  // ie4 only
  ...code...
else if (document.layers) // nn4 only
  ...code...
...etc....



if (document.all) //  IE4+ browsers (including Operas that support 'all')
 ...code...
else if(document.getElementById)  // moz browsers only -- because IE already dropped out
... code...
...etc...

The only reason I can see for using the 2nd construct is if you intend to use some jscript, activeX, other form of MS proprietary stuff.

Vinny

Posted: Tue Jul 20, 2004 12:07 pm
by feyd
regardless, you should still write to allow it..

Posted: Tue Jul 20, 2004 1:02 pm
by zeugma
thanks for the replies :)

i'm looking into using something like the following at the moment...

Code: Select all

<Meta http-equiv=Page-Enter Content=revealTrans(Duration=0.0,Transition=0)>
<Meta http-equiv=Page-Exit Content=revealTrans(Duration=0.0,Transition=0)>
i realize that this could easily not work with most browsers. but it seems to mostly solve the problem in IE, at least.

i will look into your solution next, if i run into hassles with this.

thanks again

Posted: Tue Jul 20, 2004 1:06 pm
by Vincent Puglia
Hi feyd,

Theoritically, you're right; but in the absence of a user's specific requirements, I assume (possibly incorrectly) the environment is for the newer browsers. If all browsers need to be covered, a lot more code needs to be added:

1) a final else statement for catching browser versions less than 4; and,
2) assorted fixes for NN4 (whose divs, to be operational, need to be absolutely positioned, etc., etc. -- dependent upon actual usage/intent)

Vinny