如何使用JavaScript或jQuery刷新父页面后保留iframe src? [英] How to retain iframe src after refreshing the parent page using JavaScript or jQuery?
问题描述
我正在设计一个具有Master Page和iframe的ASP.NET应用程序。当我点击主页面中的链接时,该链接在iframe中打开,但如果我刷新父页面,iframe会丢失它的源并返回一个空白框架。
如何在刷新页面(如Parallel的Plesk Panel)之后保留iframe src
属性?
有几种方法临时存储iframe的
URL
,然后检索它会在下一页重新加载。- 将其存储为cookie
- 使用
localStorage
-
使用window.name
- er,no。哈。开玩笑。这是一个很糟糕的破解。 - 使用管理localStorage的小包之一,如果必须的话,默认返回到cookie。 >
您可能需要阅读 HTML5本地存储回退解决方案了解更多有关这些选项的信息。
I am designing an application in ASP.NET which has a Master Page and a iframe. When I click on a link within the Master Page, the link is opened in the iframe, but if I refresh the parent page the iframe loses it's source and returns a blank frame.
How can I retain the iframe
src
attribute after refreshing the page like Parallel's Plesk Panel?解决方案There are a couple of ways to temporary store the
URL
of the iframe and then retrieve it on the next page reload.- Store it as a cookie
- Use
localStorage
Usewindow.name
-- er, no. Ha. Just kidding. That is a bad hack.- Use one of the small packages that manage localStorage and default back to cookies if it must.
You might want to read HTML5 Local Storage fallback solutions for more info on those options.
这篇关于如何使用JavaScript或jQuery刷新父页面后保留iframe src?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!