Can I make browsers display contents of a window triggered by onClick before page finishes loading?

G

Graham J

Hello,

Apologies for the somewhat wordy and garbled subject as I couldn't think how
to phrase it and this has hindered my searching for any previous answers.
It could be a really simple question. Anyway...

I have a simple javascript function that opens up a new window and writes
HTML code in it to display an image (I don't just display the image because
of problems with different margins in different browsers). Nothing exotic
there. I call this via 'onClick' on various links. Again nothing unusual
there.

The problem is that if I click on a link before the page is completely
loaded the various browsers I have tried will open the new window and even
write the HTML into it (Opera clearly does), but will wait until all the
images etc on the original page have been completely loaded before
displaying the image in the new window. This is in contrast to what happens
when you click on a normal link as that tends to take priority over the
original page.

Is there anything I can do to make my window jump the queue and be displayed
fully immediately?

G.
 
L

Lasse Reichstein Nielsen

Graham J said:
Is there anything I can do to make my window jump the queue and be displayed
fully immediately?

Probably not.

What happens is what always happens when you open two pages at a time.
The browser only have a certain number of connections open at a time.
Other images that need to be loaded are queued, and will be loaded
when there is a connection available. The original page probably
already queued a bunch of images, so the new page starts out at the
back of the line. There is no way to prioritize the elements.

/L
 
G

Graham J

Is there anything I can do to make my window jump the queue and be
displayed
Probably not.

That is pretty much what I expected but it was worth a try :)
What happens is what always happens when you open two pages at a time.
The browser only have a certain number of connections open at a time.
Other images that need to be loaded are queued, and will be loaded
when there is a connection available. The original page probably
already queued a bunch of images, so the new page starts out at the
back of the line. There is no way to prioritize the elements.

That is certainly how I see things happening too.

In my original post I suggested that clicking on a normal link seemed to
jump the queue but having just tried it again I realise I didn't have the
whole story. If the link is to an image file then that will be loaded
straight away, jumping the queue as it were, but if it is to an HTML file it
seems any extra downloads required join the back of the queue (using IE, but
I think it is typical behaviour).

Oh well, on to plan B (well more like J actually...).

G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top