如何使用JavaScript或jQuery刷新父页面后保留iframe src? [英] How to retain iframe src after refreshing the parent page using JavaScript or jQuery?

查看:76
本文介绍了如何使用JavaScript或jQuery刷新父页面后保留iframe src?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个具有Master Page和iframe的ASP.NET应用程序。当我点击主页面中的链接时,该链接在iframe中打开,但如果我刷新父页面,iframe会丢失它的源并返回一个空白框架。



如何在刷新页面(如Parallel的Plesk Panel)之后保留iframe src 属性?

解决方案

有几种方法临时存储iframe的 URL ,然后检索它会在下一页重新加载。


  1. 将其存储为cookie

  2. 使用 localStorage

  3. 使用 window.name - er,no。哈。开玩笑。这是一个很糟糕的破解。

  4. 使用管理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.

    1. Store it as a cookie
    2. Use localStorage
    3. Use window.name -- er, no. Ha. Just kidding. That is a bad hack.
    4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆