【问题标题】:How to get parent url from a php iFrame inside of html block如何从 html 块内的 php iFrame 获取父 url
【发布时间】:2011-04-08 19:54:16
【问题描述】:

我在 html 页面中有一个 php iFrame。我必须这样做,因为它是第 3 方网站。我试图用 $_GET[] 调用一些 url val,但它不起作用。然后我发现它是一个路径问题。

如何在 html 中从 php iFrame 调用 url 变量?

谢谢

【问题讨论】:

  • 您提供的是父 html 文档还是 iframe 文档?

标签: php html url iframe


【解决方案1】:

Php 是服务器端,但要管理框架,您需要类似 javascipt 之类的东西,它可以在客户端运行。我很害怕你把这两种东西混在一起。

http://www.tek-tips.com/viewthread.cfm?qid=1281918&page=6

<script type="text/javascript" language="javascript">
<!--
function refreshIframe(){
    var iframeid = "sessionlog";
     var h = parent.window.getElementById(iframeid).src;
     parent.window.getElementById(iframeid).src = h;
}
//-->
</script>

另外,您需要执行重定向的代码:

<SCRIPT language="JavaScript">
<!--
window.location="http://someplace.com";
//-->
</SCRIPT>

【讨论】:

  • 但是必须有一种方法可以从 iFrame 调用并在地址栏中获取根 URL 否?
猜你喜欢
  • 2011-04-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-08
  • 2015-11-18
  • 2010-09-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多