如何将ID从父级传递到在不同域上运行的iframe?

问题描述

我需要将一个ID从HTML文档传递给另一个。在下面的示例中,ID为“ 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6e”。

父HTML文档位于localhost:5500,子with orderinfo as ( select id,first_value(orderdate) over (partition by id order by date) as first_order_date,first_value(orderdate) over (partition by id order by price desc) as max_price_order_date from orders ) select p.*,o.* from orderinfo oi join orders o on o.id = oi.id join person p on p.id = o.id where oi.max_price_order_date - oi.first_order_date < interval '10 years' ; 文档位于localhost:4444。

当前,父文档像这样嵌入<iframe>

<iframe>

我有多个父HTML文档(父编号1,父编号2,父编号3 ...),但是一个唯一的index.html <body> <h1>This is parent number 1</h1> <div id="embedded_messenger"> <header id="message_header" onclick="Chat.toggle()">Chat</header> <iframe id="chat_client" src="http://localhost:4444/index.html?id=9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6e"></iframe> </div> <script src="http://localhost:4444/embed.js"></script> <script> var options = {}; Chat.boot(options); </script> </body> 中嵌入的内容)因此我无法在index.html文件中进行任何硬编码,因为不同的父级文档实际上正在使用它。

我已经尝试通过URL参数传递ID,并尝试通过<iframe>

获取它。

我也已经尝试过通过window.parent[0].location.search.replace('?id=','')setCookie函数传递ID,但是由于文档位于两个不同的域中,因此并不明显。

您是否知道我该如何在ID中传递ID?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)