View Full Version : Random image PHP scripts failing in Safari?
lucidmedia
Aug 13, 2009, 11:48 PM
Hi all,
Has anyone else had issues with PHP image randomizing scripts not working in safari?
I had originally used this one from A List Apart: http://www.alistapart.com/articles/randomizer/
and it works fine in all browsers, except my version of Safari (4.0.2)
I tried a few other random image scripts and they failed as well!
In safari, the first image loads up fine, but it does not rotate on page reload. If you close your session and start again, you get a new image.
Cache issue? Should I try to append the filename with a random timestamp, etc?
thanks in advance...
Cerebrus' Maw
Aug 14, 2009, 01:08 AM
If you think its a caching issue, you can always tell the browser to not cache regardless including
<?php
header("Cache-Control: no-cache, must-revalidate");
?>
in your php.
Any chance a link to your site?
lucidmedia
Aug 14, 2009, 02:19 AM
If you think its a caching issue, you can always tell the browser to not cache regardless including
<?php
header("Cache-Control: no-cache, must-revalidate");
?>
in your php.
Any chance a link to your site?
Thanks Cerebrus...
Unfortunately I can't link... the site is not yet live and is password protected... but the entire script I am using is on the a list apart site...
Its interesting that every script I have tried seems to have the same issue in safari.
I will give your suggestion a try, but don't want to shut down caching 100%
I have run into the same problem before when loading dynamic content into flash and had to append a random timestamp into the request. I may also try adding this...
Cerebrus' Maw
Aug 14, 2009, 04:11 AM
Safari can indeed to odd things with dynamic content. I've ran into something similar when calling a php via Ajax. Basically the PHP program was a compressor for image files, that returned an id for the output image. Worked fine in Firefox, but on Safari it returned a 200 OK message each time, which was from the compressor itself, rather then the script.
I've heard it mentioned that safari can be quite slow to update such content, that basically it "trips" over itself. Solution maybe to actually put in a small time buffer from when the script returns and to when it actually displays.
SrWebDeveloper
Aug 14, 2009, 07:53 AM
Turn on the debugger in Safari via: Safari preferences > Advanced > Show Develop Menu in menu bar
Report what you see here in terms of errors.
If no error, as a test, choose from the Safari menu: Develop - User Agent - <any other windows client (Firerox or IE)> - some report Ajax or server side dynamic scripts start working when true. But that means a Safari bug beyond your control to resolve if the prior resolutions posted here do not work.
-jim
lucidmedia
Aug 14, 2009, 12:55 PM
Thanks all!
I will do the above and post the results tonight...
lucidmedia
Aug 15, 2009, 12:26 AM
Hi Jim,
No errors are being flagged, and there is no result if the user agent is changed.
If I disable cache it starts working as expected... almost. Image refreshes are occasionally intermittent. I find that safari's cache is just "stickier" than the other browsers...
thanks for all your help.
SrWebDeveloper
Aug 15, 2009, 01:32 AM
Cheers
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.