Hi Guys,
I used an example from adobe.com to make a spry scoreboard that automatically updates the scores from an xml document. I took it futher and have had some success, but when I put it live I found out that it will not update in internet explorer unless clearing history, or opening a new tab then going back.
It works great in firefox and safari, and will update as soon as I change the xml, then upload to my server. Any help would be greatly appreciated. I have searched long and hard for a solution, and it looks like I.E caching may be the culprit. How to get around this though I do not know.
I have put up the demo files from the example as it has the same issue regarding I.E
Thank you!!
Rich
http://www.richyobrien .com/spry_scoreboard/my_scores.html
I used an example from adobe.com to make a spry scoreboard that automatically updates the scores from an xml document. I took it futher and have had some success, but when I put it live I found out that it will not update in internet explorer unless clearing history, or opening a new tab then going back.
It works great in firefox and safari, and will update as soon as I change the xml, then upload to my server. Any help would be greatly appreciated. I have searched long and hard for a solution, and it looks like I.E caching may be the culprit. How to get around this though I do not know.
I have put up the demo files from the example as it has the same issue regarding I.E
Thank you!!
Rich
http://www.richyobrien .com/spry_scoreboard/my_scores.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
<!ENTITY % SPRY SYSTEM "http://www.adobe.com/dtd/spry.dtd">
%SPRY;
]>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>My Score Board</title>
<style type="text/css">
html, body {
font-size:0px;
margin:0px;
padding:0px;
}
*html, *body {
margin-top:-2px;
}
.games {
font-size:12px;
font-family:Arial;
color:#000;
}
.SpryHiddenRegion {
display: none;
}
</style>
<script language="JavaScript" type="text/javascript" src="xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="SpryData.js"></script>
<script language="JavaScript" type="text/javascript" src="SpryEffects.js"></script>
<script type="text/javascript">
<!--//
var dsGames = new Spry.Data.XMLDataSet("games.xml", "games/game"); // Load the Overall Game information
var dsHome = new Spry.Data.XMLDataSet("games.xml", "/games/game/home", { subPaths: ["teamStats", "teamStats/score" ], useCache:false, loadInterval:3000}); // Load all of the Home Team Information
var dsAway =new Spry.Data.XMLDataSet("games.xml", "/games/game/away", { subPaths: ["teamStats", "teamStats/score" ], useCache:false, loadInterval:3000}); // Load all of the Away Team Imformation
var HScoreHolder = new Array(); // Home Score Holder
var AScoreHolder = new Array(); // Away Score Holder
var scoreHolder = new Array(); // Generic Score Holder
function GetScoreUpdateFunc(scoreHolder, prefixStr){ // Get score function
return function (ds, row, rowIndex){ // return the actual filter function
var key = prefixStr+row['teamStats/score/@quarter']; // create a key for the games
if(scoreHolder[key]){ // check for keys already set
if(row['teamStats/score'] != scoreHolder[key]){ // check to see if the scores match. If they don't, then show the update
Spry.Effect.DoHighlight(key,{duration:3000,from:'#FB9A00', to:'#fff', restoreColor:'#fff'});// highlight the updated score box
}
}
scoreHolder[key]= new Array(); // make each key an array
scoreHolder[key]= row['teamStats/score']; // get the current scores
return row; // return the regular dataset
};
}
dsHome.filter(GetScoreUpdateFunc(HScoreHolder, "hq_")); // Filter for home scores... Check for updates
dsAway.filter(GetScoreUpdateFunc(AScoreHolder, "aq_")); // Filter for away scores... Check for updates
//-->
</script>
</head>
<body>
<div class="games SpryHiddenRegion" spry:detailregion="dsGames dsHome dsAway">
<h1>{dsGames::location}</h1>
<table cellpadding="0" cellspacing="0" border="1">
<tr>
<th> </th>
<th spry:repeat="dsHome">{dsHome::ds_RowNumberPlus1}</th>
<th>Time Outs Used</th>
<th>Foul Trouble</th>
</tr>
<tr>
<td>{dsHome::teamName}</td>
<td spry:repeat="dsHome" id="hq_{dsHome::teamStats/score/@quarter}">{dsHome::teamStats/score}</td>
<td>{dsHome::teamStats/@timeOuts}</td>
<td>{dsHome::teamStats/@foulTrouble}</td>
</tr>
<tr>
<td>{dsAway::teamName}</td>
<td spry:repeat="dsAway" id="aq_{dsAway::teamStats/score/@quarter}">{dsAway::teamStats/score}</td>
<td>{dsAway::teamStats/@timeOuts}</td>
<td>{dsAway::teamStats/@foulTrouble}</td>
</tr>
</table>
</div>
</body>
</html>
Comment