Forum Moderators: open

Message Too Old, No Replies

IE no-cache

i know about 64k buffer too :)

         

g00fy_m

6:14 am on Sep 10, 2005 (gmt 0)

10+ Year Member



hi all,

i am trying to force IE to get the latest version of a page.

i have streaming audio that plays on load, then when you click an image within a form the audio changes (well in firefox at least :) )

the only way i can get it to work in IE is to set the Internet Options to force new page on every visit,

is there another way, otherwise all IE clients will not get effect of this marketing tool unless they go to the trouble of changing internet options.

i have tried this so far: (this eg plays same audio for each image)


<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<!-- // -- // -->
<!-- webaudio content follows -->
<iframe src="http://www.example.com.au/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1" name="audio_frame" id="audio_frame" frameborder="0" width="1" height="1" scrolling="no" style="background-color:#000000;"></iframe>
<!-- end webaudio content -->
<!-- // --
<form action="http://www.example.com.au/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1" method="post" name="media_form" target="audio_frame">
<p align="center">
<input name="" type="image" src="images_1.png">
</p>
<p align="center">
<input name="" type="image" src="images_2.png">
</p>
<p align="center">
<input name="" type="image" src="images_3.png">
</p>
</form>
</BODY>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>

any help would be greatly appreciated

g00fy

[edited by: tedster at 7:25 am (utc) on Sep. 10, 2005]

[edited by: encyclo at 7:07 pm (utc) on Sep. 11, 2005]
[edit reason] Use example.com and fix sideways scroll [/edit]

encyclo

5:42 pm on Sep 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The easiest way of ensuring that the page is never cached is to use HTTP headers (sent before the page is displayed) rather than the very unreliable meta tags.

I see you're using PHP - you can add HTTP headers to ensure that the page is never cached at the top of your page like this:

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

This should make IE refresh from the server each time.

Reference: PHP header function [ca.php.net]

moltar

5:54 pm on Sep 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can also add random rubbish to the end of the URL string for your audio file. For example:

/music.midi?rubbish=13476325463265483245

It will not affect your file, but the browser will think it's a new file and will load a fresh copy every time. You can use some rand() function to get the random stuff in there or md5() on user's IP address and current time or something like that.

g00fy_m

1:51 am on Sep 11, 2005 (gmt 0)

10+ Year Member



i tried random data in body of the page hosting the IFRAME, 100 lines of random numbers.

also i *am* using php at the moment but this idea is to be retorofitted onto existing sites that may or may not be using a server language.

regards

g00fy

g00fy_m

2:20 am on Sep 11, 2005 (gmt 0)

10+ Year Member



ok this is what i have now and it still doesnt work in IE :(

lets hope IE7 offers as much to the programmers as it does to the public, current beta isnt looking like it :(


<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test Audio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<!-- // ------------------------------------------------------------------------- // -->
<!-- webaudio content follows -->
<iframe src="http://www.example.com/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1&amp;refresh=<?= microtime()*1000000?>" name="audio_frame" id="audio_frame" frameborder="0" width="1" height="1" scrolling="no" style="background-color:#000000;"></iframe>
<!-- end webaudio content -->
<!-- // ------------------------------------------------------------------------- // -->
<p align="center">
<a href="http://www.example.com/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1&amp;refresh=<?= microtime()*1000000?>" target="audio_frame" >
<img src="images_1.png" border="0" />
</a>
</p>
<p align="center">
<a href="http://www.example.com/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1&amp;refresh=<?= microtime()*1000000?>" target="audio_frame" >
<img src="images_2.png" border="0" />
</a>
</p>
<p align="center">
<a href="http://www.example.com/webaudio/play_media.php?mid= 746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1&amp;refresh=<?= microtime()*1000000?>" target="audio_frame" >
<img src="images_3.png" border="0" />
</a>
</p>
</BODY>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>

[edited by: tedster at 3:48 am (utc) on Sep. 11, 2005]

[edited by: encyclo at 7:08 pm (utc) on Sep. 11, 2005]
[edit reason] use example.com in code - not real url [/edit]

moltar

2:22 am on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



100 lines of random numbers

You don't need that much. About 20-30 characters should be sufficient. The best way imho is to use md5() on user IP + current time + cpu cycles

this idea is to be retorofitted onto existing sites that may or may not be using a server language.

you can use javascript (client side) to generate random numbers

header("Cache-Control: no-cache, must-revalidate");  
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

This also will only work if you have PHP (server side) installed.

g00fy_m

3:17 am on Sep 11, 2005 (gmt 0)

10+ Year Member



i realise all this, i have been using php for over 5 yrs, but i have never had this problem, such that it is imperative not to cache the page.

100 lines goes to the fact that the page is being cached, my next attempt was as suggested and shows that each href has a unique refresh attribute on it and its still not working in IE

it seems that its may not be a cache problem though as the php header has no effect.

if i could post url's here i could show you the problem in IE that works in FF :(

kind regards,
g00fy

tedster

4:03 am on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it is imperative not to cache the page

Isn't it the page WITHIN the iframe that needs not to be cached? Do you have PHP cache-control headers there?

g00fy_m

4:19 am on Sep 11, 2005 (gmt 0)

10+ Year Member



yes


<?php

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

$mediaFile = $_GET['mid'];
$backColor = $_GET['bc'];
$width = $_GET['w'];
$height = $_GET['h'];
$autoplay = $_GET['ap'];

$autoplay = $autoplay == "1"? "true" : "false";

//echo 'height: ' . $height . ' width: ' .$width . "<br />" .
// 'backColor: ' . $backColor . ' mediaFile: ' . $mediaFile;

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Web Audio Player</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
<body bgcolor="#<?= $backColor?>">
<div style="position: absolute; top: 0px; left: 0px;" id="flashPlayer">
<OBJECT id="intro"
codeBase="http://www.example.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
height="21" width="63" align="texttop"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" VIEWASTEXT>
<PARAM NAME="Movie" VALUE="http://www.example.com/webaudio/player.swf?mid=<?= $mediaFile?>&amp;ap=<?= $autoplay?>">
<PARAM NAME="WMode" VALUE="transparent">
<PARAM NAME="Quality" VALUE="High">
<PARAM NAME="BGColor" VALUE="#<?= $backColor?>">
<embed src="http://www.example.com/webaudio/player.swf?mid=<?= $mediaFile?>&amp;ap=<?= $autoplay?>"
width="63" height="21" align="middle" wMode="transparent"
pluginspace="http://www.example.com/go/getflashplayer">
</embed>
</OBJECT>
</div>
</body>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>

[edited by: g00fy_m at 4:24 am (utc) on Sep. 11, 2005]

g00fy_m

4:21 am on Sep 11, 2005 (gmt 0)

10+ Year Member



i am starting to think that this is yet another IE problem, but i cant work out what it is, i thinking that it my not be a caching problem as the PHP statements have no effect at all

regards,
g00fy

henry0

10:56 am on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did I understand that the refresh should have an action on an Iframe?

If so the Iframe will not be refreshed but only the hosting page

Out of curiosity did you try to (for the test purpose only) get rid of the iframe and include its content in your main page?

g00fy_m

11:14 am on Sep 11, 2005 (gmt 0)

10+ Year Member



the refresh attrib is just to make the URI unique for each call, to try and fool IE into thinking it is a different request it has no effect other than making the URI different for each request to the same page

as for the IFRAME, i changed the link from one of the images that would normally target the IFRAME. so when u click image it goes straight to that page, still no good in IE :(

also if i refresh the page with that holds IFRAME i get nothing, IE will only play the first audio stream and that is it again :(, yet both URL's are the same except for the refresh attrib

so i am thinking that this is some really weird IE problem i have not yet found, or it may be a cache problem, but PHP cache control headers have no effect

any ideas pls?

henry0

11:30 am on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's about using a frame not iframe?

check that also
[p2p.wrox.com...]

g00fy_m

11:58 am on Sep 11, 2005 (gmt 0)

10+ Year Member



has to be an iframe, because i might have several on one page at random locations (random, meaning more scattered than framesets allow)

also that link is not really relevant. let me explain

i have a parent page, that contains (1 for the moment) iframe. teh source of the iframe is a php page that accesses db and returns a flash player that auto plays a media stream. so the page holding the flash player playing the stream is in hte iframe (but hiddne cause iframe size is 1,1)

the problem is taht whenever i reload the page or target the iframe with another link it doesnt work. only the first link (the src link) works when the iframe is first loaded.

why is this so, i have no idea, it all works perfect in FF, if you want a test site link email me

henry0

3:40 pm on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK I have an idea since the php page comes from your DB I imagine that is has a name for ex: my_page.php
So why not add through concatenation a rand number before php
I have it done often in a multiple users environment to be sure that another user cannot guess the location of the other users
Something like:
my_pagea3sK.php
Since its name changes it has to refresh

This in combo with a forced refresh via header should work.

Now I remember some sort of similar trouble with IE
No way to refresh on my local machine but it worked 0n other machines
Did you try it on another machine?

If that thread moves in a PHP direction you might ask a mod to move the thread in PHP

tedster

4:36 pm on Sep 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I also notice that you have the <head> section AFTER the <body> section on the code you pasted in. I don't know if that's creating your IE problem, but standard order can't hurt.

g00fy_m

11:06 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



the second head section is a client side IE fix for its 64k buffer problem, htuis in IE the first head is basically ignored

it works for certain things but apparently not this

henry

thanx for your suggestion too, i will try that, this also means though that the client must have javascript enabled or i cant 'dynamically' concat the string to the target url.

ill let you know
g00fy

g00fy_m

11:15 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



ok i tried this now and it still doesnt play except for first visit to the first page, this is really getting to me now


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<!-- // ------------------------------------------------------------------------- // -->
<!-- webaudio content follows -->
<iframe src="http://www.example.com.au/webaudio/play_media.php?mid=746f796f74613a746f796f7461&amp;bc=000000&amp;w=63&amp;h=21&amp;ap=1&amp;refresh=240012" name="audio_frame" id="audio_frame" frameborder="0" width="1" height="1" scrolling="no" style="background-color:#000000;"></iframe>
<!-- end webaudio content -->
<!-- // ------------------------------------------------------------------------- // -->
<p align="center">
<a href="index.php" >
<img src="images/toyota_1.png" border="0" />
</a>
</p>
<p align="center">
<a href="iindex.php" >
<img src="images/toyota_2.png" border="0" />
</a>
</p>
<p align="center">
<a href="iiindex.php" >
<img src="images/toyota_3.png" border="0" />
</a>
</p>
</BODY>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD>
</HTML>

notice that href page changes by number of 'i' prefix

so i have three pages in dir, one for each images audio

could this be anything other than a cache problem?

sorry henry i have tried it on other machines than my test machine and server

regards,
g00fy

g00fy_m

11:25 pm on Sep 11, 2005 (gmt 0)

10+ Year Member



henry i cant see how to get your idea working,

the page that holds the iframe needs to be targetted with play_media.php?args

i realise this is more php, but you have offered that this is acheivable

if i target it with play_mediaxyz123.php?args, where do i catch this at to strip out the xyz123 and return the play_media.php?args

kind regards,
g00fy

henry0

11:57 am on Sep 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm! I am starting to be lost :)

It should not be striped but red out of your DB (the extension)
So in my mind I envision a template that will be copied then written on with the new extension in such a way that it always is a new file

If not only the extension but also the whole file is loaded in your DB you will have to write a script that will del any file old instances

As I mentioned earlier the whole thing might become a PHP thread

Have you tried to post in “site graphic and multi media”

Next


has to be an iframe, because i might have several on one page at random locations (random, meaning more scattered than framesets allow)

I think that you might considering to exit the iframe environment,
All of that would be easily addressed if you would consider how much of predetermination in randomly adding snippets you could have

Simply: create a page template with for ex 10 predetermined snippets location
And than only deal with including the snippets randomly or at a predetermined location, so you keep some form of random within a controlled situation

g00fy_m

12:14 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



ok i get the idea now,

but that is not how it works, the mid hash is the query that returns a link to the media file, nothing else.

i will try and ask this question in the multimedia fora

also, iframe was being used as a remoting idea, so the 'main' page didnt have to be refreshed.

the problem (i think) will not be fixed by using forms either as i had a test version using the form idea and it did not work BUT all images were asking for the same media file, so MAYBE (hoping desperately) it will work for distinct media files.

otherwise i put a big banner at top of page that reads

.... IE does not conform to standards, please download firefox to hear this web pages voice ....

:D

thanx for all your suggestions

regards,
g00fy