2013-02-07 71 views
0

我已經嘗試了很多解決方案,但在我的網站沒有作品。Iframe自動高度100%與跨域

現在我用:

<iframe src="http://www.travelstoremaker.com/ibe/turismoin/porch?command=flights" frameborder="0" marginwidth="0" marginheight="0" width="906" height="5000"></iframe> 

你可以在這裏看到:http://turismo-in.it/voli-in-italia/

現在我已經發現這一點:

var transport = new easyXDM.transport.BestAvailableTransport({ 
    local: "../hash.html", 
    remote: "http://provider.easyxdm.net/example/resized_iframe.html", 
    container: document.getElementById("element_that_should_contain_the_frame"), 
    onMessage: function(message, origin){ 
     this.container.getElementsByTagName("iframe")[0].style.height = message + "px"; 
    } 
}); 

然後你把I幀體以下內容後

var transport = new easyXDM.transport.BestAvailableTransport({}, function(){ 
    transport.postMessage(document.body.scrollHeight); 
}); 

但是怎麼做呢?我必須在哪裏添加它?有用?!有一個解決方案來自動調整跨域iframe的高度?

P.S.我無法更改我的頁面中的代碼iframed,但只在我的網站

回答

0

如果您無法更改iframed頁面上的代碼,則無法獲得所需的高度。我已經嘗試了很多解決方案,而且我唯一的工作就是使用郵件。但是,您必須能夠從iframe中發佈消息。