|
-
Apr 7th, 2007, 03:05 PM
#1
Thread Starter
Frenzied Member
Problem updating iframe content from server side
Hi ronald thanks for your reply. i even add following:
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
but still the data does not change. I can see that request is being made and i changed the iframe contnt manually and i still don't see the updated data get fetched!! . could you look at this code beleow and let me know why updated data does not get fetched even when i am making frequen request to server?Thanks
Note: i am making frequen call to getnewdata() function
data output on screen : But it never change even when i update iframecontent.php manually and make frequen call to it!!

iframe inside javascript:
Code:
<div id="text" style="z-index:90;" class="chatWindowTextDisplay"
title="Chat Transcript - "
alt="Chat Transcript -"
><iframe name="textFrame" id="textFrame" src="http://localhost/iframeContent.php?cmd=file&file=chatTemplate&template=chatText&site=676789&sessionkey=H9030219168890559071K46359640" frameborder="0" border="0" width="350" height="220" class="chatWindowTextFrame"
title="Chat Transcript - "
alt="Chat Transcript - "
>This functionality requires frames. </a>.</iframe>
</div>
<script type="text/javascript">
document.getElementById("text").tabindex = 3;
document.getElementById("textFrame").tabindex = 3;
</script>
<script type="text/javascript">
document.writeln('<div id="hiddentext" style="z-index:0;position:absolute;visibility:hidden;left:0;top:13px">'+
'<iframe name="lpCommFrame" id="lpCommFrame" src="http://localhost/iframecontent.php" frameborder="0" border="0" width="350" height="220" title="Background">'+
'This functionality requires frames. </iframe>'+
'</div>');
function getnewdata()
{
var u = "http://localhhost/iframecontent.php/?cmd=file&file=chatText&site=676789&sessionkey=H7221484707459237529K46228278&d=" + jsGetDate();
document["lpCommFrame"].location = u;
jsCheckCommFrame();
}
function jsGetDate()
{
var d = new Date();
return d.getTime();
}
function jsCheckCommFrame() {
//alert("jscheckcommframe");
var win = window.frames['lpCommFrame'];
try{
if ((typeof(win) == "undefined") || (win.document.body == null) || (typeof(win.document.body) == "undefined"))
return;
}catch(e){
reportError(e,'jsCheckCommFrame_win');
return;
}
//test for server error
var newtext = win.document.body.innerHTML;
if ( newtext!=null && typeof(newtext)!="undefined" && (newtext!="")) {
var controlmsg = newtext.substring(0,10);
if (controlmsg == "<br>Server") {
lpOnSendTextFail( lastText, 1);
return;
}
}
var textArray = win.chatLines;
if(textArray==null) return;
var lineCount = textArray.length;
if (lineCount != prevLineCount) {
prevLineCount = lineCount;
//convert chat array
var chatLines = new Array();
for(iline=0; iline<lineCount; iline++){
var jLine = textArray[iline];
if(jLine.length!=4) continue;
chatLines[iline] = new LPChatLine( jLine[0], jLine[1], jLine[2], jLine[3] );
}
if( lpLastLineIndex != chatLines.length ) {
lpOnAddLines( chatLines, lpLastLineIndex );
lpLastLineIndex = chatLines.length;
}
unsentLine = "";
// If we have unsent lines because we switched from Java to Javascript - send the next line.
if (sendingUnsentLines){
sendUnsentLines();
}
}
//push url
var pushURL = win.pushURL;
win.pushURL = "";
if (pushURL != "") {
lpOnURLPush(pushURL);
}
//handle control command
var controlCommand = win.controlCommand;
win.controlCommand = "";
if ((typeof(controlCommand) != "undefined") && (controlCommand != null) && (controlCommand != "")) {
handleControlCommand(controlCommand);
}
}
<script>
iframecontent.php:
Code:
<?
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
<head>
<link href="./window.css" rel="stylesheet" type="text/css" />
<title>Window</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Live " />
<meta name="keywords" content="live" />
<style>
BODY {
width:334px
}
</style>
</head>
<body bgcolor="white" style="margin: 0" onload="scrollwindow()" class="contentWrapper">
<script type="text/javascript">
var chatLines = [["I am testing this i frame","Bob","4","1175958864183"],
["i do not know how this is working","Bob","1","1175958880480"],
["could any one tell me","Bob","1","1175958883949"]
];
function scrollwindow()
{
if ((navigator.appName.indexOf("Netscape") < 0) || (parseInt(navigator.appVersion)>4))
scroll(0, 50000);
}
var wasInChat = true;
var pushURL = "";
var controlCommand = "";
document.controlCommand = controlCommand;
if (navigator.appName.indexOf("Netscape") >= 0)
scroll(0, 50000);
</script>
<noscript><p>
This functionality requires JavaScript. Please enable JavaScript and try again.
</noscript>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td dir="ltr" class="chatContent">
<div id="chatContentDiv" style="font-size: smaller; font-family: arial, arial, helvetica, geneva;">
<span style="color: blue;"><b><span class="OperatorName">Bob: </span></b></span>
<span style="color: black;"><span class="OperatorText">I am testing this i frame</span><br /></span>
<span style="color: blue;"><b><span class="OperatorName">Bob: </span></b></span>
<span style="color: black;"><span class="OperatorText">i do not know how this is working</span><br /></span>
<span style="color: blue;"><b><span class="OperatorName">Bob: </span></b></span>
<span style="color: black;"><span class="OperatorText">could any one tell me</span><br /></span>
</div>
</td>
</tr>
</table>
</body>
</html>
Last edited by tony007; Apr 8th, 2007 at 10:33 AM.
-
Apr 8th, 2007, 04:34 AM
#2
Re: Problem updating iframe content from server side
I haven't looked at your code.
When you have determined that new data is available, do you actually refresh iframecontent.php or do you just let it sit there expecting it to magically update itself? You can make a call to only refresh iframecontent.php, not the whole page, and that should be enough.
-
Apr 8th, 2007, 10:21 AM
#3
Thread Starter
Frenzied Member
Re: Problem updating iframe content from server side
mendhak if you read the code you see i do call iframecotent.php but still my iframe does not update!!
function getnewdata()
{
var u = "http://localhhost/iframecontent.php/?cmd=file&file=chatText&site=676789&sessionkey=H7221484707459237529K46228278&d=" + jsGetDate();
document["lpCommFrame"].location = u;
jsCheckCommFrame();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|