gpt4 book ai didi

javascript - 将数据发布到 iframe(aspx) 以在 aspx 页面的页面加载中捕获它

转载 作者:行者123 更新时间:2023-12-03 10:28:32 26 4
gpt4 key购买 nike

我有一个 HTML 页面和一个 iframe(aspx 页面),如下所示。

Mypage.htm

<div>
<iframe name="Frame1" id="ff1" src="http://example.com/example.aspx" frameborder="0" scrolling="no" height="600" width="500" style="text-decoration:none;" marginwidth="5"></iframe>
</div>

此 Mypage.htm 将作为来自其他页面的链接提供,用户单击这些页面,Mypage.htm 将在新选项卡中打开。

我想将数据发布到 iframe。发布的数据是“网站”=“true”(发布的数据只是一个标识,是固定的)。发布的数据在 iframe 中的 aspx 页面的 page_load 中捕获。

所以现在我很困惑如何将数据发布到框架以及在哪个事件。我应该能够在 aspx 页面的页面加载中获取发布的数据。如何做到这一点。

最佳答案

只需使用查询字符串而不是发布数据:

<div>
<iframe name="Frame1" id="ff1" src="http://example.com/example.aspx?website=true" frameborder="0" scrolling="no" height="600" width="500" style="text-decoration:none;" marginwidth="5"></iframe>
</div>

并在Page_Load中检查Request.QueryString["website"](而不是Request.Form["website"])。

关于javascript - 将数据发布到 iframe(aspx) 以在 aspx 页面的页面加载中捕获它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29314271/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com