View Full Version : repeat animated gif on return to page?
swanky
08-14-2006, 09:38 PM
Can anyone tell me how to use HTML so that an animated gif, that only plays once, will play again after another link has been clicked and then the user returns to the original page (using back button)? any help would be great.
jscheuer1
08-15-2006, 03:22 AM
You mean it doesn't? I would have thought that it would. I'm thinking that it may in some browsers and not in others. Do you have a link to the page?
swanky
08-15-2006, 03:39 PM
yojimbo.pwp.blueyonder.co.uk
and I use firefox so no messing there. Its my first attempt at a web page and its the header graphic that I want to repeat, to match the sound.
I'll try looking at it in IE but surely thats a bad idea?
swanky
08-15-2006, 03:45 PM
yeah you were right. It works in IE but not in my firefox. hmm. the sound doesn't match up in IE though, like it does with firefox. Ah well, such is life. Thanks
Yes, I've noticed this. You could try using Javascript to reset the src of the image. That should cause it to play again.
swanky
08-15-2006, 09:01 PM
ok, I've never used javascript but i'll give it a try tomorrow. cheers.
jscheuer1
08-16-2006, 06:01 AM
In that case, try something simple, like replacing this:
<H1 Align=CENTER> <IMG SRC="yojimboSign.gif"> </H1>
<embed src="electricity.wav" loop="false" autoplay="true" hidden="true"></embed>
with this:
<h1 align="center"> <img id="yojimbo" src="yojimboSign.gif"> </h1>
<embed src="electricity.wav" loop="false" autoplay="true" hidden="true"></embed>
<script type="text/javascript">
document.getElementById('yojimbo').src="yojimboSign.gif";
</script>
What about flash, I think it would be better, because <embed> takes more time (resources?) to initialize, and, well, flash is more common than just image and sound separately.
bentness
08-17-2006, 10:52 AM
Does it not automatically do this on every new click?
What about flash, I think it would be better, because <embed> takes more time (resources?) to initialize... what?
You do realise that using Flash would also involve an <embed> element?
It may be easier, but it's not as well supported.
swanky
08-18-2006, 08:27 PM
thanks John, my internet's been down but i'll put that code in soon. you the man.
swanky
08-18-2006, 10:16 PM
unfortunately that code didn't sort the problem. I'm searching the internet now and i've found other people witht the same problem but no fix yet, that doesn't involve a button. Does anyone know a way to blank an image in HTML as if I did that first I could repaint the .gif?
jscheuer1
08-19-2006, 05:34 AM
There are all sorts of things that you could try but, it would be easier for me to weed out the obvious no-gos than it would be for you. I'm not sure how to test this locally but, I haven't tried to yet. If I can set up a local test that behaves as badly as your live page does in FF, then I can probably find a solution. I'll get right on it.
jscheuer1
08-19-2006, 07:06 AM
I'm afraid that may be correct after all. The trouble is that FF doesn't even run onload functions when the page is returned to using the back button, let alone scripts that are merely in the page flow like my example was. The only thing that I can think of that might help would be to set the page to not be cached under any circumstances using your server's HTTP Headers. I'm not all that familiar with this but, here is a good reference, I think:
http://www.mnot.net/cache_docs/#IMP-SERVER
swanky
08-20-2006, 06:54 PM
ahh.I'll read over HTTP headers when I get some time, its not that important anyway, just a bit annoying. Thanks guys, if ever you need anything...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.