2011-04-08 100 views
0

我在html頁面中有一個php iFrame。我必須這樣做,因爲它是第三方網站。我試圖用$ _GET []調用一些url vals,但它不起作用。然後我想出了它的一個路徑問題。如何從html塊中的php iFrame獲取父url url

如何在html中調用php iFrame的url變量?

感謝

+0

你服務父HTML文檔或iframe的文檔? – 2011-04-08 19:56:27

回答

0

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> 
+0

但是必須有一種方法可以從iFrame中調用並獲取地址欄中的根URL嗎? – 2011-04-09 00:00:39