MozillaZine

Slow Image update after refresh

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 18th, 2009, 1:37 am

Hi,

I'm developing a browser game and I have a problem after I do a full
refresh (CTRL+F5); The problem is that images set using javascript
first show the image unavailable placeholder (the square with the red
dot in it) and get replaced with the real image afterwards.

The strange thing is that this only occurs after I press CTRL+F5. If I
press F5 after the full refresh, the image loading is normal again.

This problem is quite annoying because I need to update some images
every second, which causes the image to flicker with the image placeholder.

I would be grateful for some pointers.

Best regards,

AlDee

trolly
Moderator

User avatar
 
Posts: 39157
Joined: August 22nd, 2005, 7:25 am

Post Posted December 18th, 2009, 4:28 am

F5 loads from cache, CTRL-F5 bypasses the cache. You should check your caching strategy.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 18th, 2009, 7:07 am

Stupid question, but is there any reason you expect your users to press Ctrl+F5 often during a game?
Groetjes, Pim

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 18th, 2009, 7:15 am

Pim wrote:Stupid question, but is there any reason you expect your users to press Ctrl+F5 often during a game?


No, I expect not.. But I know that I do it sometimes, so I expect others will..

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 18th, 2009, 7:19 am

trolly wrote:F5 loads from cache, CTRL-F5 bypasses the cache. You should check your caching strategy.


Thanks for the info. But I'm don't know what you mean. All I do now is set the expires header of all images to 31 days into the future.

If you press CTRL-F5, how long does firefox keeps bypassing the cache? I hope only the very first time an image is needed? But if this
is not the case and FF keeps bypassing the cache, then this might explain the behaviour.

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 18th, 2009, 7:52 am

Hm.... are you saying that, after the user has pressed Ctrl+F5 once, the window shows the "image unavailable" icon initially every time the screen is repainted, not just the first time?
Until the user presses F5?

That's odd.

Can you provide a live link to your game? Or a page that demonstrates this behaviour?
Groetjes, Pim

trolly
Moderator

User avatar
 
Posts: 39157
Joined: August 22nd, 2005, 7:25 am

Post Posted December 18th, 2009, 8:11 am

The bypass is only for exactly one time loading the entire page. Depending on how you load your images it can take some time to get them e.g. if you load them using JS in the onload event handler or even later.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 18th, 2009, 11:34 am

Pim wrote:Hm.... are you saying that, after the user has pressed Ctrl+F5 once, the window shows the "image unavailable" icon initially every time the screen is repainted, not just the first time?
Until the user presses F5?

That's odd.

Can you provide a live link to your game? Or a page that demonstrates this behaviour?


Yes, this is exactly what happens.

You can try it here:
http://www.mytholia.info

But you'll have to register first:
http://www.mytholia.info/register.php

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 20th, 2009, 12:28 pm

Well, I've been browsing the game a little bit (to be honest, not much more than moving around, since trying to do things resulted in errors most of the time) but I can't see any difference in behaviour before and after pressing Ctrl+F5. Or F5, or clearing the cache. So I don't know what to say.
Groetjes, Pim

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 20th, 2009, 12:55 pm

I have uploaded a video of the behavior I described. You can download it here:
http://www.mytholia.info/mytholia_refresh.avi

I do a hard refresh at about 7 seconds into the video when everything is fully
loaded I open the barracks and there you can see the flickering images.

I do a normal refresh at second 27 which (the barracks are opened again
automatically). This time there is no flickering.

Hope this helps.

Groetjes, AlDee ;)

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 20th, 2009, 1:47 pm

No.
I mean, yes, I see the flickering icons in your video, but they don't flicker when I do that.
I even built a barrack, so I could get the same popup window, but no, sorry.

Anyone else have ideas?
Groetjes, Pim

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 20th, 2009, 2:10 pm

Strange, I've disabled all extensions to make sure it is not firebug or something else that's causing the problem. But with all extensions disabled, I still have the problem.

Could you maybe try to keep clicking on the barrack building? This forces a manual redraw and gives the same behavior when I try it.

If you can't see it then, I'm all out of ideas.

Ah, I'm using FF 3.5.6 on Vista. I don't know if it matters.

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 20th, 2009, 2:35 pm

Oh... I do have Vista at work, so I should be able to test tomorrow morning. In theory. However, I'm not sure how my colleagues would feel about me playing a game, for, ahem, research purposes.

Do other people playing the game have the same problem? Have you asked in the forum? (I can't seem to perform searches in the forum.)
Groetjes, Pim

AlDee
 
Posts: 9
Joined: December 18th, 2009, 1:34 am

Post Posted December 20th, 2009, 2:42 pm

Pim wrote:Oh... I do have Vista at work, so I should be able to test tomorrow morning. In theory. However, I'm not sure how my colleagues would feel about me playing a game, for, ahem, research purposes.


Everything in the name of science!

No, I would appreciate it if you could try.

Pim wrote:Do other people playing the game have the same problem? Have you asked in the forum? (I can't seem to perform searches in the forum.)


Yes, other people have the same problem. I know of at least four people that have seen the problem. But not every time. I just asked someone to try it, and he had to refresh 5 times before he saw it. (He also uses vista btw).

I appreciate you trying to help me.

Best regards,

AlDee

Pim

User avatar
 
Posts: 2151
Joined: May 17th, 2004, 2:04 pm
Location: Netherlands

Post Posted December 21st, 2009, 4:51 am

Yes. It does happen under Vista! After some refreshes it's worse than after others, but it's definitely there. And yes, after pressed F5 it stops.
So the good news is you can tell all the players that the problem is known and that they can all solve it by upgrading to XP.
The bad news is that I have no idea what the difference is, what Firefox would be doing differently after F5 than it does before. It doesn't make sense.
Groetjes, Pim

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests