-
Notifications
You must be signed in to change notification settings - Fork 6.3k
修复同一域名下的多个 iframe 共享相同的缓存,可能导致页面展示混乱问题 #4811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Preview mcp_server Image: |
Preview sandbox Image: |
Preview fastgpt Image: |
多个 iframe, sessionStorage 不共享的呢,只有 localStorage 共享。 |
问题描述: 思考问题发生的过程:
代码示例: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
辩论
<iframe style="width: 49vw; height: 49vh; display: inline-block;" src="https://aaa.com/chat?appId=123&token=xxx"></iframe>
面试
<iframe style="width: 49vw; height: 49vh; display: inline-block;" src="https://aaa.com/chat?appId=456&token=xxx"></iframe>
编程
<iframe style="width: 49vw; height: 49vh; display: inline-block;" src="https://aaa.com/chat?appId=789&token=xxx"></iframe>
英语
<iframe style="width: 49vw; height: 49vh; display: inline-block;" src="https://aaa.com/chat?appId=000&token=xxx"></iframe>
</body> |
1、appld 和 chatld 的存储方式: 在 usechatStore.ts 中,appld、chatld 和 source 被存储在 sessionStorage中,而其他状态被存储在 localstorage 中。
2、iframe 共享存储: 同一域名下的多个 iframe 共享相同的 sessionStorage 和 localStorage,这可能导致状态混乱。
3、状态恢复逻辑: 当页面加载时,FastGPT 会尝试从存储中恢复状态,但这个恢复逻辑可能在多个 iframe 快速切换时出现问题。