iframe会话有时不起作用

时间:2014-01-15 08:42:17

标签: javascript php iframe

您好我有一个iframe和.php页面。我刷新页面时试图保留页面。我使用session来阻止iframe返回它的默认src =“”页面。我在Remeber iFram SRC when refreshing parent page看到了这个技巧。但问题是当我尝试刷新时,有时它会阻止它回到它的默认src =“”页面,有时它会回到它的默认src =“”页面。有什么问题?

<?php
session_start(); // before any output to the user-agent / browser /screen!!!
print('<iframe src="'.$_SESSION['last_visited'].'"></iframe>')
?>

<li><a href="1.php" target="contents">1</a></li>
<li><a href="2.php" target="contents">2</a></li>
<li><a href="3.php" target="contents">3</a></li>
<li><a href="4.php" target="contents">4</a></li>

<iframe name="contents" src="index.html" id="iframe1" frameborder="0"></iframe>

我把它放在我的所有页面中

<?php
session_start(); // before any output to the user-agent / browser /screen!!!
$_SESSION['last_visited'] = $_SERVER['REQUEST_URI'];
?>

我还在http://www.webdeveloper.com/forum/showthread.php?64667-how-to-force-an-iframe-to-reload

中看到了这个document.getElementById('iFrame').contentDocument.location.reload(true);

请帮忙吗?

0 个答案:

没有答案
相关问题