页面有一个标题和一个iFrame。 iFrame包含来自第三方应用的内容。 第三方应用程序来自与页面不同的服务器。 用户将大部分时间花在iFrame上。
如果用户将大部分时间花在iFrame上,则首页会话将超时。
有什么可能的方法来阻止这种情况? 有没有办法检测iFrame中的回发事件并在首页增加超时计时器?
任何示例代码表示赞赏。
谢谢
Page has a header and an iFrame. The iFrame has content from a 3rd party app. The 3rd party app is leaded from a different server than the page. The user will spend most of their time in the iFrame.
If the user spends most of their time in the iFrame the top page session will timeout.
What possible ways are there to prevent that? Is there a way to detect post back events in the iFrame and increment the timeout timer in the top page?
Any sample code is appreciated.
Thanks
最满意答案
您可以在主页面上添加另一个隐藏的IFrame,该IFrame设置为每10分钟刷新一次(或者在会话超时内的任何内容)。 这将导致主页上的会话保持活动状态,而用户不会刷新任何页面。
编辑添加请求的示例
var frameHTML=''; function CheckFrame() { //get frame BODY var frameBody=$("#FFRAMEID1" + _frameNumber).contents().find("body").html(); //Compare if(frameBody==frameHTML) { //Content has not changed. Do not refresh main session. } else { //Content has changed. Refresh main session. } //Set most recent check string frameHTML=frameBody; //Set OTHER hidden frame source to refresh main page (could be replaced by just an AJAX call) $('#FRAMEID2').attr("src", 'FRAMESRC'); }You could add another, hidden IFrame on the main page that is set to refresh every 10 minutes (or whatever sits within the session timeout). This would cause the session on the main page to stay alive without the user experiencing any page refreshes.
EDIT to add requested example
var frameHTML=''; function CheckFrame() { //get frame BODY var frameBody=$("#FFRAMEID1" + _frameNumber).contents().find("body").html(); //Compare if(frameBody==frameHTML) { //Content has not changed. Do not refresh main session. } else { //Content has changed. Refresh main session. } //Set most recent check string frameHTML=frameBody; //Set OTHER hidden frame source to refresh main page (could be replaced by just an AJAX call) $('#FRAMEID2').attr("src", 'FRAMESRC'); }更多推荐
发布评论