简体   繁体   English

刷新父页面时如何刷新iframe?

[英]How to refresh iframe when parent page is refreshed?

I have one iframe within parent page. 我在父页面中有一个iframe。 People can navigate using iframe page. 人们可以使用iframe页面进行导航。 When parent page is refreshed iframe content reloads original src . 刷新父页面后,iframe内容会重新加载原始src。 What I need is when parent page is refreshed to refresh iframe too, but not the original src but what may be on the page on that very moment. 我需要的是刷新父页面时也刷新iframe,但不是原始src,而是那一刻可能在页面上的内容。 Maybe someone has a better solution. 也许有人有更好的解决方案。

Thank you 谢谢

You cannot do that as when parent page is refreshed, whole HTML along with original IFrame SRC will be returned from the server. 您无法执行此操作,因为刷新父页面时,将从服务器返回整个HTML以及原始IFrame SRC。

The only way to do so is, store the new SRC of IFrame in Cookies or Server Session and while serving the parent page from server, get this Cookie/Server Session value and based on that load the IFrame 这样做的唯一方法是,将新的IFrame SRC存储在Cookie或服务器会话中,并在从服务器提供父页时,获取此Cookie /服务器会话值,并基于该负载加载IFrame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM