iFrame中的第三方应用必须保持标头/顶部框架会话处于活动状态(3rd party app in an iFrame must keep header/top frame session alive

编程入门 行业动态 更新时间:2024-10-27 22:27:07
iFrame中的第三方应用必须保持标头/顶部框架会话处于活动状态(3rd party app in an iFrame must keep header/top frame session alive)

页面有一个标题和一个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'); }

更多推荐

本文发布于:2023-07-22 02:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1215996.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第三方   框架   状态   party   iFrame

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!